- Button
- Date Picker
- Field
- Fields
- Input Group
- File Uploader
- Signature Pad
- Text Area
- Container
- Section Header
- Separator
- Spacer
- Action Row
- Breadcrumb
- Tabs
- Tabs Container
- Card
- Image
- Text
- Title
- Video Player
- Card Collection
- Data Grid
- List Collection
- Table Collection
- Bar Chart
- Big Number
- Line Chart
- Radial Chart
- Hint
- Progress
- Spinner
- Skeleton
- Toast
- Sheet
- Dialog
- Real-world patterns
- Primitives
Spreadsheet-like data grid built on react-data-grid with inline editing, copy-paste, keyboard navigation, and dynamic column generation.
Basic Usage
The simplest form displays an editable grid with text and number columns.
Dynamic Columns
Generate columns dynamically from external data source definitions. This is useful when column structure comes from an API or configuration.
Row Selection & Batch Operations
Enable row selection with checkboxes and batch operations like delete and copy.
Custom Cell Editors
Use different editor types for different data types: text, number, date, and dropdown select.
Full-Featured Grid
All features enabled: search, add/delete rows, row selection, sorting, and custom toolbar actions.
Variants
Striped Variant (Compact)
Alternating row backgrounds with compact spacing for dense data.
Minimal Variant
Clean design with top border only.
Column Helper Functions
The component provides helper functions to create commonly used column types:
// Row numbering column (frozen, non-editable)
createRowNumberColumn<TData>(): Column<TData>
// Selection checkbox column
createSelectColumn<TData>(): Column<TData>
// Editable text input
createEditableTextColumn<TData>(key: string, name: string, width?: number): Column<TData>
// Editable number input
createEditableNumberColumn<TData>(key: string, name: string, width?: number): Column<TData>
// Editable date picker
createEditableDateColumn<TData>(key: string, name: string, width?: number): Column<TData>
// Editable dropdown select
createEditableSelectColumn<TData>(
key: string,
name: string,
options: string[],
width?: number
): Column<TData>
// Read-only text column
createTextColumn<TData>(key: string, name: string, width?: number): Column<TData>
// Generate columns from external definitions
createDynamicColumns<TData>(definitions: ColumnDefinition[]): Column<TData>[]Keyboard Shortcuts
The Data Grid includes built-in keyboard navigation for a spreadsheet-like experience:
| Shortcut | Action |
|---|---|
| Arrow Keys | Navigate between cells |
| Tab | Move to next cell |
| Shift+Tab | Move to previous cell |
| Enter | Edit selected cell |
| Escape | Cancel editing |
| Ctrl+C (or Cmd+C) | Copy selected cells (TSV format) |
| Ctrl+V (or Cmd+V) | Paste clipboard data |
| Delete | Clear selected cell content |
| Shift+Arrow | Extend selection range |
Copy-Paste Functionality
The Data Grid supports Excel-compatible copy-paste:
- Cell-level: Select cells and press Ctrl+C to copy in TSV format
- Row-level: Use toolbar "Copy Selected Rows" button
- All data: Use toolbar "Copy All Data" button
Copied data can be pasted directly into Excel, Google Sheets, or any application that accepts TSV format.
Props API
| Prop | Type | Default | Description |
|---|---|---|---|
data | TData[] | - | Array of data objects to display |
columns | Column<TData>[] | - | Column definitions (use helper functions) |
columnDefinitions | ColumnDefinition[] | - | Optional: Generate columns dynamically |
onDataChange | (data: TData[]) => void | - | Callback when data changes (edit/add/delete) |
variant | "default" | "minimal" | "striped" | "default" | Visual style variant |
size | "default" | "compact" | "default" | Size variant |
enableRowSelection | boolean | false | Enable checkbox row selection |
enableAddRow | boolean | false | Show "Add Entry" button in toolbar |
enableDeleteRow | boolean | false | Show "Delete" button when rows selected |
enableSearch | boolean | false | Show search input in toolbar |
enableSorting | boolean | false | Enable column sorting |
searchPlaceholder | string | "Search..." | Placeholder text for search input |
onAddRow | () => TData | - | Function that returns a new empty row object |
toolbarActions | ReactNode | - | Custom action buttons in toolbar |
showToolbar | boolean | true | Show/hide toolbar |
emptyMessage | string | "No data available" | Message when no data |
rowHeight | number | 35 | Height of each row in pixels |
className | string | - | Additional CSS classes for grid |
classNames | object | - | CSS classes for wrapper, toolbar, grid |
ColumnDefinition Type
When using dynamic columns via columnDefinitions:
interface ColumnDefinition {
key: string; // Data property key
name: string; // Column header label
type: "text" | "number" | "date" | "select"; // Editor type
editable?: boolean; // Whether column is editable (default: true)
options?: string[]; // Options for "select" type
width?: number; // Column width in pixels
}