Layout
The Data Grid offers multiple options to control its layout.
Width
Pagination
You can add pagination and adjust the page size using
initialState (here 5 rows per page):
library(dplyr)
DataGrid(
rows = starwars |> select(name, height, mass) |> head(10),
pageSizeOptions = c(5, 10, 25),
initialState = list(
pagination = list(
paginationModel = list(pageSize = 5)
)
)
)Toolbar and CSV export
Set showToolbar = TRUE to display the toolbar, which
includes column, filter, density, and export controls. The
Export button can download the current data as a CSV
file.
See the Localization vignette to fix accented characters
(ä becomes ä, è becomes
è) in CSV exports for Excel.