% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shiny.R
\name{ggsqlOutput}
\alias{ggsqlOutput}
\alias{renderGgsql}
\title{Shiny bindings for ggsql}
\usage{
ggsqlOutput(outputId, width = "100\%", height = "400px")

renderGgsql(expr, reader = NULL, env = parent.frame(), quoted = FALSE)
}
\arguments{
\item{outputId}{Output variable to read from.}

\item{width, height}{CSS dimensions for the output container.}

\item{expr}{An expression that returns a ggsql query string or a \code{Spec}
object. Strings may contain \code{r:varname} references that resolve variables
from the expression's local scope (see Examples).}

\item{reader}{A \code{Reader} object created by \code{\link[=duckdb_reader]{duckdb_reader()}}. When \code{NULL}
(the default), the session reader set by \code{\link[=ggsql_session_reader]{ggsql_session_reader()}} is used.}

\item{env}{The environment in which to evaluate \code{expr}.}

\item{quoted}{Logical. Is \code{expr} a quoted expression?}
}
\value{
\code{ggsqlOutput()} returns a Shiny UI element. \code{renderGgsql()} returns
a Shiny render function.
}
\description{
Render ggsql visualizations in a Shiny application. \code{renderGgsql()} accepts
either a ggsql query string or a \code{Spec} object (returned by
\code{\link[=ggsql_execute]{ggsql_execute()}}). When given a string, it validates and executes the query
against \code{reader}.
}
\examples{
\dontshow{if (interactive() && requireNamespace("shiny", quietly = TRUE)) withAutoprint(\{ # examplesIf}
library(shiny)

ui <- fluidPage(
  ggsqlOutput("chart")
)

server <- function(input, output, session) {
  ggsql_session_reader(duckdb_reader())

  output$chart <- renderGgsql({
    "SELECT * FROM r:mtcars VISUALISE mpg AS x, disp AS y DRAW point"
  })
}

shinyApp(ui, server)
\dontshow{\}) # examplesIf}
}
