react-data-grid
- Version 7.0.0-beta.64
- Published
- 713 kB
- No dependencies
- MIT license
Install
npm i react-data-gridyarn add react-data-gridpnpm add react-data-gridOverview
Feature-rich and customizable data grid React component
Index
Variables
Functions
Interfaces
Type Aliases
Namespaces
Variables
variable DataGridRenderersContext
const DataGridRenderersContext: any;Functions
function useHeaderRowSelection
useHeaderRowSelection: () => { isIndeterminate: any; isRowSelected: any; onRowSelectionChange: any;};function useRowSelection
useRowSelection: () => { isRowSelectionDisabled: any; isRowSelected: any; onRowSelectionChange: any;};Interfaces
interface CalculatedColumn
interface CalculatedColumn<TRow, TSummaryRow = unknown> extends Column<TRow, TSummaryRow> {}property cellClass
readonly cellClass: Column<TRow, TSummaryRow>['cellClass'];property colSpan
readonly colSpan: Column<TRow, TSummaryRow>['colSpan'];property draggable
readonly draggable: boolean;property editable
readonly editable: Column<TRow, TSummaryRow>['editable'];property editorOptions
readonly editorOptions: Column<TRow, TSummaryRow>['editorOptions'];property frozen
readonly frozen: ColumnFrozen;property getColSpan
readonly getColSpan: ( args: ColSpanArgs<TRow, TSummaryRow> | undefined) => number;Returns the number of columns that the cell spans: the clamped value returned by
colSpan, or1
property headerCellClass
readonly headerCellClass: Column<TRow, TSummaryRow>['headerCellClass'];property idx
readonly idx: number;The index of the column in the grid. Column groups are flattened and frozen columns are moved to their edge, so it can differ from the column's index in
columns
property level
readonly level: number;Header row level, counted from the bottom header row: always
0for columns, and negative for column groups
property maxWidth
readonly maxWidth: number | undefined;property minWidth
readonly minWidth: number;property parent
readonly parent: CalculatedColumnParent<TRow, TSummaryRow> | undefined;The column group that contains the column, or
undefinedif the column is not in a group
property renderCell
readonly renderCell: ( props: RenderCellContentProps<TRow, TSummaryRow>) => ReactNode;property renderEditCell
readonly renderEditCell: Column<TRow, TSummaryRow>['renderEditCell'];property renderGroupCell
readonly renderGroupCell: Column<TRow, TSummaryRow>['renderGroupCell'];property renderHeaderCell
readonly renderHeaderCell: ( props: RenderHeaderCellContentProps<TRow, TSummaryRow>) => ReactNode;property renderSummaryCell
readonly renderSummaryCell: Column<TRow, TSummaryRow>['renderSummaryCell'];property resizable
readonly resizable: boolean;property sortable
readonly sortable: boolean;property sortDescendingFirst
readonly sortDescendingFirst: Column<TRow, TSummaryRow>['sortDescendingFirst'];property summaryCellClass
readonly summaryCellClass: Column<TRow, TSummaryRow>['summaryCellClass'];property width
readonly width: number | string;interface CalculatedColumnParent
interface CalculatedColumnParent<R, SR> {}property colSpan
readonly colSpan: number;property headerCellClass
readonly headerCellClass?: Maybe<string>;property idx
readonly idx: number;property level
readonly level: number;property name
readonly name: string | ReactElement;property parent
readonly parent: CalculatedColumnParent<R, SR> | undefined;interface CellMouseArgs
interface CellMouseArgs<TRow, TSummaryRow = unknown> {}property column
column: CalculatedColumn<TRow, TSummaryRow>;The column object of the cell.
property row
row: TRow;The row object of the cell.
property rowIdx
rowIdx: number;The row index of the cell.
property setActivePosition
setActivePosition: (options?: SetActivePositionOptions) => void;Sets the active position to the cell. Pass
{ enableEditor: true }to open its editor, or{ shouldFocus: true }to also focus it.
interface Column
interface Column<TRow, TSummaryRow = unknown> {}property cellClass
readonly cellClass?: Maybe<string | ((row: TRow) => Maybe<string>)>;Class name(s) for cells
property colSpan
readonly colSpan?: Maybe< (args: ColSpanArgs<TRow, TSummaryRow>) => Maybe<number>>;Returns the number of columns that the cell spans, or
undefinedfor no spanning. The span is clamped to the start-frozen, unfrozen, or end-frozen columns, whichever the column is part of.
property draggable
readonly draggable?: Maybe<boolean>;Enable dragging of the column
property editable
readonly editable?: Maybe<boolean | ((row: TRow) => boolean)>;Control whether cells can be edited with
renderEditCell
property editorOptions
readonly editorOptions?: Maybe<{ /** * Render the cell content in addition to the edit cell content. * Enable this option when the editor is rendered outside the grid, like a modal for example. * By default, the cell content is not rendered when the edit cell is open. * @default false */ readonly displayCellContent?: Maybe<boolean>; /** * Commit changes when clicking outside the cell * @default true */ readonly commitOnOutsideClick?: Maybe<boolean>; /** * Close the editor when the row value changes externally * @default true */ readonly closeOnExternalRowChange?: Maybe<boolean>;}>;Options for cell editing
property frozen
readonly frozen?: Maybe<ColumnFrozen | true>;Determines whether the column is frozen, and on which edge.
trueis an alias for'start'for backward compatibility.
property headerCellClass
readonly headerCellClass?: Maybe<string>;Class name(s) for the header cell
property key
readonly key: string;A unique key to distinguish each column
property maxWidth
readonly maxWidth?: Maybe<number>;Maximum column width in pixels
property minWidth
readonly minWidth?: Maybe<number>;Minimum column width in pixels 50
property name
readonly name: string | ReactElement;The name of the column. Displayed in the header cell by default
property renderCell
readonly renderCell?: Maybe< (props: RenderCellContentProps<TRow, TSummaryRow>) => ReactNode>;Render function to render the content of cells
property renderEditCell
readonly renderEditCell?: Maybe< (props: RenderEditCellContentProps<TRow, TSummaryRow>) => ReactNode>;Render function to render the content of edit cells. When set, the column is automatically set to be editable
property renderGroupCell
readonly renderGroupCell?: Maybe< (props: RenderGroupCellContentProps<TRow, TSummaryRow>) => ReactNode>;Render function to render the content of group cells
property renderHeaderCell
readonly renderHeaderCell?: Maybe< (props: RenderHeaderCellContentProps<TRow, TSummaryRow>) => ReactNode>;Render function to render the content of the header cell
property renderSummaryCell
readonly renderSummaryCell?: Maybe< (props: RenderSummaryCellContentProps<TSummaryRow, TRow>) => ReactNode>;Render function to render the content of summary cells
property resizable
readonly resizable?: Maybe<boolean>;Enable resizing of the column
property sortable
readonly sortable?: Maybe<boolean>;Enable sorting of the column
property sortDescendingFirst
readonly sortDescendingFirst?: Maybe<boolean>;Sets the column sort order to be descending instead of ascending the first time the column is sorted
property summaryCellClass
readonly summaryCellClass?: Maybe< string | ((row: TSummaryRow) => Maybe<string>)>;Class name(s) for summary cells
property width
readonly width?: Maybe<number | string>;Column width. If not specified, it will be determined automatically based on grid width and specified widths of other columns 'auto'
interface ColumnGroup
interface ColumnGroup<R, SR = unknown> {}property children
readonly children: readonly ColumnOrColumnGroup<R, SR>[];property headerCellClass
readonly headerCellClass?: Maybe<string>;property name
readonly name: string | ReactElement;The name of the column group. It will be displayed in the header cell
interface ColumnWidth
interface ColumnWidth {}interface FillEvent
interface FillEvent<TRow> {}interface GroupRow
interface GroupRow<TRow> {}property childRows
readonly childRows: readonly TRow[];The rows of the group, including the rows of its subgroups
property groupKey
readonly groupKey: string;The group's key, returned by
getRowGroupKey
property id
readonly id: string;The group's ID, returned by
getGroupId
property isExpanded
readonly isExpanded: boolean;Whether the group is expanded, i.e., its ID is in
expandedGroupIds
property level
readonly level: number;The nesting level,
0for the first level
property parentId
readonly parentId: string | undefined;The ID of the parent group, or
undefinedon the first level
property posInSet
readonly posInSet: number;The position of the group among its sibling groups,
0for the first one
property setSize
readonly setSize: number;The number of sibling groups, including this one
property startRowIndex
readonly startRowIndex: number;The index of the group row among all the rows, counting every group as expanded
interface PositionChangeArgs
interface PositionChangeArgs<TRow, TSummaryRow = unknown, TActiveRow = TRow> {}property column
column: CalculatedColumn<TRow, TSummaryRow> | undefined;column object of the active position, undefined if the active position is a row instead of a cell
property row
row: TActiveRow | undefined;row object of the active position, undefined if the active position is on a header or summary row. In
TreeDataGrid, it can be aGroupRow, seeisGroupRow
property rowIdx
rowIdx: number;row index of the active position
interface RenderCellContentProps
interface RenderCellContentProps<TRow, TSummaryRow = unknown> {}property column
column: CalculatedColumn<TRow, TSummaryRow>;property isCellEditable
isCellEditable: boolean;property onRowChange
onRowChange: (row: TRow) => void;property row
row: TRow;property rowIdx
rowIdx: number;property tabIndex
tabIndex: number;interface RenderCellProps
interface RenderCellProps<TRow, TSummaryRow> extends BaseRenderCellProps<TRow, TSummaryRow> {}property colSpan
colSpan: number;property column
column: CalculatedColumn<TRow, TSummaryRow>;property isCellActive
isCellActive: boolean;property isDraggedOver
isDraggedOver: boolean;property onRowChange
onRowChange: ( column: CalculatedColumn<TRow, TSummaryRow>, rowIdx: number, newRow: TRow) => void;property row
row: TRow;interface RenderCheckboxProps
interface RenderCheckboxProps {}property 'aria-label'
'aria-label'?: string | undefined;Accessible label for the checkbox
property 'aria-labelledby'
'aria-labelledby'?: string | undefined;ID of the element that labels the checkbox
property checked
checked?: boolean | undefined;Whether the checkbox is checked
property disabled
disabled?: boolean | undefined;Whether the checkbox is disabled
property indeterminate
indeterminate?: boolean | undefined;Whether the checkbox is in an indeterminate state, like the select all checkbox when only some rows are selected
property onChange
onChange: (checked: boolean, shift: boolean) => void;Called when the checkbox is toggled.
shiftistrueif the Shift key was held, to select a range of rows
property tabIndex
tabIndex?: number | undefined;0when the checkbox's cell is active and-1otherwise, so the grid can move focus from the cell to the checkbox
interface RenderEditCellContentProps
interface RenderEditCellContentProps<TRow, TSummaryRow = unknown> {}property column
column: CalculatedColumn<TRow, TSummaryRow>;property onClose
onClose: (commitChanges?: boolean, shouldFocus?: boolean) => void;property onRowChange
onRowChange: (row: TRow, commitChanges?: boolean) => void;property row
row: TRow;property rowIdx
rowIdx: number;interface Renderers
interface Renderers<TRow, TSummaryRow> {}property noRowsFallback
readonly noRowsFallback?: Maybe<ReactNode>;property renderCell
readonly renderCell?: Maybe< (key: Key, props: RenderCellProps<TRow, TSummaryRow>) => ReactNode>;property renderCheckbox
readonly renderCheckbox?: Maybe<(props: RenderCheckboxProps) => ReactNode>;property renderRow
readonly renderRow?: Maybe< (key: Key, props: RenderRowProps<TRow, TSummaryRow>) => ReactNode>;property renderSortStatus
readonly renderSortStatus?: Maybe<(props: RenderSortStatusProps) => ReactNode>;interface RenderGroupCellContentProps
interface RenderGroupCellContentProps<TRow, TSummaryRow = unknown> {}property column
column: CalculatedColumn<TRow, TSummaryRow>;property row
row: GroupRow<TRow>;The group row: its key, rows, expanded state, level, and ID
property tabIndex
tabIndex: number;property toggleGroup
toggleGroup: () => void;Expands or collapses the group
interface RenderHeaderCellContentProps
interface RenderHeaderCellContentProps<TRow, TSummaryRow = unknown> {}property column
column: CalculatedColumn<TRow, TSummaryRow>;property priority
priority: number | undefined;property sortDirection
sortDirection: SortDirection | undefined;property tabIndex
tabIndex: number;interface RenderRowProps
interface RenderRowProps<TRow, TSummaryRow = unknown> extends BaseRenderRowProps<TRow, TSummaryRow> {}property activeCellEditor
activeCellEditor: ReactElement<EditCellProps<TRow, TSummaryRow>> | undefined;property draggedOverCellIdx
draggedOverCellIdx: number | undefined;property isTreeGrid
isTreeGrid: boolean;property onRowChange
onRowChange: ( column: CalculatedColumn<TRow, TSummaryRow>, rowIdx: number, newRow: TRow) => void;property row
row: TRow;property rowClass
rowClass: Maybe<(row: TRow, rowIdx: number) => Maybe<string>>;interface RenderSortIconProps
interface RenderSortIconProps {}property sortDirection
sortDirection: SortDirection | undefined;The sort direction of the column, or
undefinedif it is not sorted
interface RenderSortPriorityProps
interface RenderSortPriorityProps {}property priority
priority: number | undefined;The column's position in
sortColumns, starting at 1, when sorting by multiple columns, orundefinedotherwise
interface RenderSortStatusProps
interface RenderSortStatusProps extends RenderSortIconProps, RenderSortPriorityProps {}interface RenderSummaryCellContentProps
interface RenderSummaryCellContentProps<TSummaryRow, TRow = unknown> {}interface RowsChangeData
interface RowsChangeData<R, SR = unknown> {}interface SelectHeaderRowEvent
interface SelectHeaderRowEvent {}property checked
checked: boolean;interface SelectRowEvent
interface SelectRowEvent<TRow> {}interface SetActivePositionOptions
interface SetActivePositionOptions {}property enableEditor
enableEditor?: Maybe<boolean>;property shouldFocus
shouldFocus?: Maybe<boolean>;interface SortColumn
interface SortColumn {}Type Aliases
type CalculatedColumnOrColumnGroup
type CalculatedColumnOrColumnGroup<R, SR> = | CalculatedColumnParent<R, SR> | CalculatedColumn<R, SR>;type CellCopyArgs
type CellCopyArgs<TRow, TSummaryRow = unknown> = CellCopyPasteArgs< TRow, TSummaryRow>;type CellKeyboardEvent
type CellKeyboardEvent = CellEvent<React.KeyboardEvent<HTMLDivElement>>;type CellKeyDownArgs
type CellKeyDownArgs<TRow, TSummaryRow = unknown, TActiveRow = TRow> = | ActiveCellKeyDownArgs<TRow, TSummaryRow, TActiveRow> | EditCellKeyDownArgs<TRow, TSummaryRow>;type CellMouseEvent
type CellMouseEvent = CellEvent<React.MouseEvent<HTMLDivElement>>;type CellPasteArgs
type CellPasteArgs<TRow, TSummaryRow = unknown> = CellCopyPasteArgs< TRow, TSummaryRow>;type ColSpanArgs
type ColSpanArgs<TRow, TSummaryRow> = | { readonly type: 'HEADER' } | { readonly type: 'ROW'; readonly row: TRow } | { readonly type: 'SUMMARY'; readonly row: TSummaryRow };type ColumnFrozen
type ColumnFrozen = false | 'start' | 'end';type ColumnOrColumnGroup
type ColumnOrColumnGroup<R, SR = unknown> = Column<R, SR> | ColumnGroup<R, SR>;type ColumnWidths
type ColumnWidths = ReadonlyMap<string, ColumnWidth>;type Direction
type Direction = 'ltr' | 'rtl';type RowHeightArgs
type RowHeightArgs<TRow> = | { type: 'ROW'; row: TRow } | { type: 'GROUP'; row: GroupRow<TRow> };type SortDirection
type SortDirection = 'ASC' | 'DESC';type TreeCellKeyDownArgs
type TreeCellKeyDownArgs<TRow, TSummaryRow = unknown> = CellKeyDownArgs< TRow, TSummaryRow, TRow | GroupRow<TRow>>;The arguments of
TreeDataGrid'sonCellKeyDown, whose active row can be aGroupRow
type TreePositionChangeArgs
type TreePositionChangeArgs<TRow, TSummaryRow = unknown> = PositionChangeArgs< TRow, TSummaryRow, TRow | GroupRow<TRow>>;The arguments of
TreeDataGrid'sonActivePositionChange, whose row can be aGroupRow
Namespaces
namespace *.css
module '*.css' {}Package Files (5)
Dependencies (0)
No dependencies.
Dev Dependencies (25)
- @eslint/markdown
- @faker-js/faker
- @tanstack/react-router
- @tanstack/router-plugin
- @types/node
- @types/react
- @types/react-dom
- @vitejs/plugin-react
- @vitest/browser-playwright
- @vitest/coverage-istanbul
- clsx
- ecij
- eslint
- jspdf
- jspdf-autotable
- oxc-transform-react
- playwright
- publint
- react
- react-dom
- typescript
- vite
- vite-plus
- vitest
- vitest-browser-react
Peer Dependencies (2)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/react-data-grid.
- Markdown[](https://www.jsdocs.io/package/react-data-grid)
- HTML<a href="https://www.jsdocs.io/package/react-data-grid"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6182 ms. - Missing or incorrect documentation? Open an issue for this package.
