ValyroUI English version

Data Grid

Таблица на 100 000 строк: группировка, фильтры, редактирование. Pro · Данные и показатели › Таблицы

Установка

npx valyro-cli@latest login
npx valyro-cli@latest add data-grid
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { DataGrid } from 'valyro-ui-pro';

Пропсы

PropTypeDefault
rows *readonly T[]All rows; search, filters, sorting and grouping run on them in the browser. Edits never mutate them.
columns *readonly DataGridColumn<T>[]Column definitions: header, value type, cell renderer, editing, validation, sizing and aggregates.
getRowId(row: T, index: number) => stringStable row id. Defaults to row.id, then the row's index.
label *stringAccessible name of the grid.
heightnumber | string520Maximum height of the scrolling area; rows are virtualized inside it. With fewer rows the grid shrinks to fit them instead of trailing empty space.
rowHeightnumberOverrides the density's row height, in px.
density'compact' | 'standard' | 'comfortable'Controlled density; use with onDensityChange.
defaultDensity'compact' | 'standard' | 'comfortable''standard'Initial density when uncontrolled.
onDensityChange(density: DataGridDensity) => voidCalled with the new density when it changes.
sortGridSortModelSort keys in priority order; Shift+click a header to add one.
defaultSortGridSortModel[]Initial sort when uncontrolled.
onSortChange(sort: GridSortModel) => voidCalled with the new sort when it changes.
filtersGridFilterModelControlled filters; use with onFiltersChange.
defaultFiltersGridFilterModel{}Initial filters when uncontrolled.
onFiltersChange(filters: GridFilterModel) => voidCalled with the new filters when it changes.
searchstringQuick-search text.
defaultSearchstring''Initial search when uncontrolled.
onSearchChange(search: string) => voidCalled with the new search when it changes.
groupBystring[]Column keys to group rows by, outermost first.
defaultGroupBystring[][]Initial groupBy when uncontrolled.
onGroupByChange(groupBy: string[]) => voidCalled with the new groupBy when it changes.
defaultGroupsExpandedbooleantrueWhether groups start expanded.
selectablebooleanfalseAdds a checkbox column (Shift+click selects a range; the header selects every filtered row).
selectedstring[]Controlled selected; use with onSelectedChange.
defaultSelectedstring[][]Initial selected when uncontrolled.
onSelectedChange(ids: string[]) => voidCalled with the new selected when it changes.
showSelectionSummarybooleantrueThe footer swaps the row count for the selected count, the selection's aggregates and "Clear selection" while rows are selected (default true). Turn off when a BulkActionBar already shows them.
columnVisibilityRecord<string, boolean>false hides a column.
defaultColumnVisibilityRecord<string, boolean>{}Initial columnVisibility when uncontrolled.
onColumnVisibilityChange(visibility: Record<string, boolean>) => voidCalled with the new columnVisibility when it changes.
columnWidthsRecord<string, number>Controlled columnWidths; use with onColumnWidthsChange.
defaultColumnWidthsRecord<string, number>{}Initial columnWidths when uncontrolled.
onColumnWidthsChange(widths: Record<string, number>) => voidCalled with the new columnWidths when it changes.
columnOrderstring[]Controlled columnOrder; use with onColumnOrderChange.
defaultColumnOrderstring[]Initial columnOrder when uncontrolled.
onColumnOrderChange(order: string[]) => voidCalled with the new columnOrder when it changes.
columnPinningGridColumnPinningControlled columnPinning; use with onColumnPinningChange.
defaultColumnPinningGridColumnPinningInitial columnPinning when uncontrolled.
onColumnPinningChange(pinning: GridColumnPinning) => voidCalled with the new columnPinning when it changes.
reorderablebooleanfalseLets headers be dragged to reorder columns (the column menu can always move them).
onRowsChange(rows: T[]) => voidCalled with the new rows after an edit.
onCellEdit(edit: DataGridCellEdit<T>) => voidCalled once per committed cell change with the updated row, the column key and the old and new values.
toolbarbooleantrueShows the search, density, columns and export controls.
exportFileNamestringShows an "Export CSV" button that downloads the filtered, sorted rows with the visible columns.
toolbarActionsReactNodeExtra toolbar content, placed before the built-in controls.
loadingbooleanfalseSkeleton rows replace the body and the footer summary; select-all and export are disabled.
emptyReactNodeReplaces the empty state shown when there are no rows.
localestringLocale for numbers, dates and counters. Defaults to the ThemeProvider locale.
labelsPartial<DataGridLabels>Overrides for the built-in English text; keys left out keep their defaults.

Похожие компоненты

  • Data Table — Таблицы с поиском и сортировкой
  • Virtual List — Виртуальный список на 100 000 строк
  • Bulk Action Bar — Панель действий над выбранными строками с горячими клавишами
  • List Block — Блок списка с картинками или иконками, описанием и значением
  • Description List — Список «ключ — значение»: столбиком, строками или сеткой с иконками
  • Tree View — Древовидные структуры
  • Accordion — Раскрывающиеся секции
  • Sortable — Сортировка перетаскиванием
  • JSON Viewer — Просмотр JSON
  • Timeline — Хронология событий
  • Card — Универсальные карточки
  • Item Card — Карточка-строка: иконка, заголовок, описание и элемент управления справа

Назад: Data Table · Далее: Virtual List · Весь раздел «Данные и показатели»