← Back to Components

Table

Styled data-frame tables with captions, column formatting, alignment, and truncation notes.

Interactive Playground

R Code

API Reference

block_table()

Renders a data frame or tibble as a shadcn-style table through the shinyblocks runtime, with R-side formatting and a reactive server-side update path.

ArgumentTypeDefaultDescription
datadata.framerequiredData frame or tibble to render.
columnsnamed listNULLOptional table_column() specs keyed by data column name.
captioncharacterNULLCaption rendered below the table.
max_rowsintegerNULLOptional row limit. Truncated tables render a footer note.
nacharacter""String used to render missing values. Per-column overrides win.
digitsintegerNULLDecimal places for default numeric formatting. NULL keeps R's format().
rownameslogicalFALSERender row.names(data) as a leading column.
row_formatfunctionNULLfunction(row, i) returning list(intent=, emphasis=, class=, style=) applied to that row's <tr>.
stripedlogicalFALSEZebra-stripe body rows.
hoverlogicalTRUEHighlight rows on hover (shadcn base behavior).
borderedlogicalFALSEDraw cell borders.
selectioncharacter"none"DT-style row selection mode: none, single, or multiple. Enables clickable rows reporting input$id_rows_selected, _row_last_clicked, and _cell_clicked.
selectedintegerNULL1-based row indices to select on load (requires selection != none).
idcharacterNULLInput id. Required to update the table from the server or to use row selection.
classcharacterNULLAdditional classes applied to the runtime table container.
stylecharacter | named listNULLInline styles applied to the runtime mount and table container.

update_block_table()

Re-renders an id-bound block_table() from the server with a freshly formatted payload (the same pipeline as the initial render).

ArgumentTypeDefaultDescription
sessionShinySessioncurrent domainShiny session.
idcharacterrequiredInput id passed to block_table(id = ).
datadata.frameNULLReplacement data frame. Re-renders with the formatting arguments below.
columns, caption, max_rows, na, digits, rownames, row_format, striped, hover, borderedmatching block_table()block_table() defaultsFormatting arguments applied when data is supplied.
loadinglogicalNULLTRUE shows skeleton rows; FALSE clears the loading state without changing data.
selectioncharacterNULLOptional new row-selection mode (none, single, multiple). NULL leaves it unchanged.
selectedintegerNULL1-based row indices to select; integer(0) clears. NULL leaves it unchanged.

table_column()

Defines per-column display options for block_table().

ArgumentTypeDefaultDescription
labelcharacterNULLHeader label. Defaults to the column name.
align'left' | 'center' | 'right''left'Text alignment for header and cells.
formatfunctionNULLFunction applied to the full R column vector before rendering. When set, digits is ignored for this column.
widthcharacterNULLOptional CSS width for the column.
digitsintegerNULLPer-column decimal places, overriding the table-level digits.
nacharacterNULLPer-column missing-value string, overriding the table-level na.
intentintent enumNULLToken-backed styling intent for every cell in the column: muted, primary, secondary, destructive, success, warning, or accent. Theme-safe.
emphasis'text' | 'soft' | 'solid''text'How an intent renders: colored text, tinted background, or filled chip.
class, stylecharacter | named listNULLEscape hatch: class / inline style on each <td>. You own theme-correctness.
header_intent, header_emphasis, header_class, header_styleintent enum | characterNULL / 'text'Same styling controls applied to the column's <th> header cell.
cell_intent, cell_emphasis, cell_class, cell_stylefunctionNULLfunction(value) callbacks over the column vector returning one entry per row; per-cell results win over the column-level styling.