% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nestable.R
\name{nestable}
\alias{nestable}
\title{Create a nestable collapsible HTML table}
\usage{
nestable(
  data_root,
  columns,
  theme = nestable_theme(),
  name_col = "name",
  name_header = NULL,
  name_col_width = NULL,
  uid = new_widget_uid()
)
}
\arguments{
\item{data_root}{A list of top-level \code{\link[=node]{node()}} objects. Build with \code{\link[=node]{node()}},
\code{\link[=rows_to_nodes]{rows_to_nodes()}}, or \code{\link[=df_to_tree]{df_to_tree()}}.}

\item{columns}{Column specification. Three forms are accepted:
\itemize{
\item A character vector of key names:
\code{c("market_cap", "ytd_return")} — headers are auto-derived
from the key (e.g. \code{"market_cap"} → \code{"Market Cap"}).
\item A \emph{named} character vector:
\code{c("Market Cap" = "market_cap", "YTD Return" = "ytd_return")} —
explicit headers, default formatting and rollup.
\item A list of \code{\link[=col_def]{col_def()}} objects for full control over formatting,
colours, and rollup behaviour.
}}

\item{theme}{A theme list from \code{\link[=nestable_theme]{nestable_theme()}}.}

\item{name_col}{Character. The node label key — the \code{name_col} used when
building the tree with \code{\link[=df_to_tree]{df_to_tree()}}, or \code{"name"} when constructing nodes
manually. Used to auto-derive \code{name_header} via title-casing when
\code{name_header} is \code{NULL}. Default \code{"name"}.}

\item{name_header}{Character. Header label for the first (name/label) column.
\code{NULL} (default) derives the label from \code{name_col} (e.g. \code{"security_name"}
→ \code{"Security Name"}).}

\item{name_col_width}{CSS width string (e.g. \code{"200px"}, \code{"30\%"}) applied to
the name column header and every name cell. \code{NULL} (default) leaves the
width unset, allowing the browser to size the column automatically.}

\item{uid}{Character. Widget UID prefix for HTML element \code{id} attributes.
Defaults to a random string so multiple tables on one page never clash.
Override only when reproducible IDs are needed (e.g. tests).}
}
\value{
An \code{\link[htmltools:browsable]{htmltools::browsable()}} \code{tagList}. Renders inline in R Markdown,
Quarto, and the RStudio Viewer; use inside \code{\link[shiny:renderUI]{shiny::renderUI()}} or
\code{\link[=renderNestable]{renderNestable()}} in Shiny apps.
}
\description{
Create a nestable collapsible HTML table
}
