DataGrid
Arguments
- rows
A data.frame of rows. An
idcolumn of 1-based row numbers is added automatically if not already present.- columns
Column definitions (list of lists, or a data.frame with one row per column). If
NULL, auto-generated fromnames(rows). Any column without an explicittypehas one inferred from the matchingrowscolumn: numeric columns get MUI'snumbertype and logical columns itsbooleantype; all other classes (includingDate,POSIXct, and factors) default tostring. Atypeyou set yourself is always kept. To get MUI's date-picker filtering, settype = "date"together with avalueGetterthat returns a JSDateexplicitly.- ...
Additional props passed directly to the MUI DataGrid component.
Value
A shiny.react element (also classed muiDataGrid) that
renders the MUI X Data Grid. Use it directly in Shiny UI, inside
renderReact(), or in a Quarto/R Markdown document.
Examples
# Minimal: column definitions are auto-generated from the data frame.
DataGrid(rows = head(iris))
# Custom columns plus an initial page size of 5 rows.
DataGrid(
rows = head(mtcars),
columns = list(
list(field = "mpg", headerName = "MPG"),
list(field = "cyl", headerName = "Cylinders")
),
initialState = list(
pagination = list(paginationModel = list(pageSize = 5))
)
)