% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paintr-app.R
\name{ptr_ui_toggle_code}
\alias{ptr_ui_toggle_code}
\title{Wire a Plot-ish Piece to a Slide-Out Code Window via the \verb{</>} Toggle}
\usage{
ptr_ui_toggle_code(plotish, code)
}
\arguments{
\item{plotish}{A plot-ish tag. The designed input is a bare
\code{ptr_ui_plot(id)} or \code{ptr_ui_inline_error(ptr_ui_plot(id), ptr_ui_error(id))} — a single \code{.ptr-card--plot} tag, where the toggle
button is injected into the card head (DOM byte-identical to the
bundled output block). An arbitrary custom output also works: a
\code{shiny.tag.list} (e.g. \code{plotly::plotlyOutput()},
\code{ggiraph::girafeOutput()}) or a childless single tag (e.g.
\code{shiny::plotOutput()}) gets the toggle button as an explicit sibling
inside the \code{.ptr-output} wrapper instead.}

\item{code}{A code piece, typically \code{ptr_ui_code(id)} built with the
same \code{id}. Its style is irrelevant — this combinator supplies the
slide-out window chrome around it.}
}
\value{
A \link[shiny:reexports]{shiny::tag} — one \code{.ptr-output} containing \code{plotish} (with
the toggle button) and the \code{.ptr-code-window}-wrapped \code{code}.
}
\description{
Output combinator: wraps a plot-ish tag (a bare \code{\link[=ptr_ui_plot]{ptr_ui_plot()}} or the
output of \code{\link[=ptr_ui_inline_error]{ptr_ui_inline_error()}}) and a bare code piece
(\code{\link[=ptr_ui_code]{ptr_ui_code()}}) in the single \code{.ptr-output} scope the bundled
JavaScript needs, injecting the \verb{</>} show-code button into the plot
card head and presenting the code inside the draggable slide-out
\code{.ptr-code-window} (with Copy / Close). The button hides/shows that
window purely DOM-locally — no Shiny input/output is involved. This is
the toggle layout \code{\link[=ptr_app]{ptr_app()}} / \code{\link[=ptr_ui]{ptr_ui()}} render internally.
}
\details{
Use this when you want the familiar toggle behaviour while still owning
the surrounding layout. For fully independent placement of the plot and
code panes (no toggle), keep the bare pieces uncombined — a standalone
\code{\link[=ptr_ui_code]{ptr_ui_code()}} is always visible and needs no wiring.
}
\examples{
ptr_ui_toggle_code(
  ptr_ui_inline_error(ptr_ui_plot("p"), ptr_ui_error("p")),
  ptr_ui_code("p", style = "window")
)
}
\seealso{
\code{\link[=ptr_ui_plot]{ptr_ui_plot()}}, \code{\link[=ptr_ui_code]{ptr_ui_code()}}, \code{\link[=ptr_ui_inline_error]{ptr_ui_inline_error()}},
\code{\link[=ptr_ui_controls]{ptr_ui_controls()}}, \code{\link[=ptr_server]{ptr_server()}}
}
