Rowpine for TanStack Table
Buy a license
DocsAPI reference

Components

The shadcn registry items: an export menu, a pivot table and a pivot designer. Their source is in your project after npx shadcn add.

rowpine 1.0.3Generated from the package's type definitions

ExportMenu

component

A dropdown button that exports the table to Excel, PDF or CSV and saves the file. While an export runs the button reads "Exporting..." and further picks are ignored. A "Selected rows only" checkbox appears when the table has selected rows, or as allowSelectedOnly says.

Source in your project: components/export-menu.tsx

Component
ExportMenu(
  { table, fileName, pdfTitle, formats, rowStyle, allowSelectedOnly, onError, label, className, theme, pdfOptions, xlsxOptions, }: ExportMenuProps,
) => any

Parameters

NameTypeDescription
__0ExportMenuPropsSee ExportMenuProps.

Returns

any

ExportMenuProps

type

Props of ExportMenu.

Source in your project: components/export-menu.tsx

Properties

NameTypeDescription
tableTableLikeA TanStack table (v8 or v9), or pivot.table from createPivot.
fileNameoptionalstringFile name without extension.
pdfTitleoptionalstringTitle printed at the top of the PDF.
formatsoptionalFormat[]Which formats to offer. Default all three.
rowStyleoptional((original: unknown) => CellStyle | undefined)Style whole rows, e.g. pivotRowStyle for pivots.
allowSelectedOnlyoptionalbooleanOffer "Selected rows only". Default: when the table has a selection.
onErroroptional((error: unknown) => void)Called when an export fails. Default: console.error.
labeloptionalstringButton text. Default 'Export'.
classNameoptionalstringClasses added to the trigger button.
themeoptional"page" | "none"Colors for the Excel and PDF files. "page" (default) reads your shadcn/ui theme, so the files look like the table; "none" keeps rowpine's defaults.
pdfOptionsoptionalPdfTableExportOptionsMore PDF options, such as pageSize or kpis. They win over the theme colors.
xlsxOptionsoptionalXlsxExportOptionsMore Excel options, such as sheetName. They win over the theme colors.

PivotTable

component

A pivot as a shadcn Table: header groups span their columns, rows with children get an expand and collapse button, and empty value cells show '-'.

Source in your project: components/pivot-table.tsx

Component
PivotTable(
  { pivot, collapsed, onCollapsedChange, defaultCollapsed, className }: PivotTableProps,
) => any

Parameters

NameTypeDescription
__0PivotTablePropsSee PivotTableProps.

Returns

any

PivotTableProps

type

Props of PivotTable.

Source in your project: components/pivot-table.tsx

Properties

NameTypeDescription
pivotPivotModelThe pivot to show, from usePivot or createPivot.
collapsedoptionalanyCollapsed group ids, to control expansion from outside.
onCollapsedChangeoptional((collapsed: Set<string>) => void)Called with the new set of collapsed ids when a row is expanded or collapsed. When given, the table does not keep its own state, so pass collapsed with it.
defaultCollapsedoptionalbooleanStart with every group collapsed when uncontrolled. Default false.
classNameoptionalstringClasses added to the bordered wrapper.

usePivot

hook

Pivot data with config; recomputes only when either changes.

Source in your project: components/pivot-table.tsx

Signature
usePivot<TData>(
  data: ReadonlyArray<TData>,
  config: PivotConfig<TData>,
  options?: ToColumnsOptions,
) => PivotModel

Parameters

NameTypeDescription
datareadonly TData[]Source rows. A new array on each render rebuilds the pivot.
configPivotConfig<TData>The pivot config. Keep the same object between renders (a constant or useMemo); a new one rebuilds the pivot.
optionsoptionalToColumnsOptionsSettings for every value column, such as an Excel number format. Same rule as config.

Returns

PivotModel

PivotDesigner

component

An Excel-style pivot designer: field list, four wells, and the pivot it builds. Uncontrolled, it starts from defaultLayoutFor.

Source in your project: components/pivot-designer.tsx

Component
PivotDesigner<TData>(
  { data, fields, layout: controlled, onLayoutChange, presets, aggregators, pivotOptions, actions, onPivotChange, className, }: PivotDesignerProps<TData>,
) => any

Parameters

NameTypeDescription
__0PivotDesignerProps<TData>See PivotDesignerProps.

Returns

any

PivotDesignerProps<TData>

type

Props of PivotDesigner.

Source in your project: components/pivot-designer.tsx

Properties

NameTypeDescription
datareadonly TData[]Source rows. The filter value lists are read from all of them.
fieldsreadonly PivotField<TData>[]The fields offered in the field list. kind decides which wells take each one.
layoutoptionalPivotLayoutThe layout, to control it. Store it as JSON to save a user's view.
onLayoutChangeoptional((layout: PivotLayout) => void)Called with each new layout. Without layout the designer also keeps the layout itself.
presetsoptionalreadonly PivotPreset[]Saved layouts offered in the Presets menu.
aggregatorsoptionalreadonly PivotAggregatorId[]Aggregations offered on value chips. Default all.
pivotOptionsoptionalToColumnsOptionsColumn options for the pivot, e.g. an Excel number format.
actionsoptional((pivot: PivotModel) => React.ReactNode)Extra toolbar content, given the current pivot (e.g. an ExportMenu).
onPivotChangeoptional((pivot: PivotModel | null) => void)Called with each new pivot.
classNameoptionalstringClasses added to the outer container.