middag-react
    Preparing search index...

    Interface DataTableProps<TData>

    interface DataTableProps<TData> {
        actionsAlwaysVisible?: boolean;
        appliedFilters?: AppliedFilters;
        bulkActions?: Action[];
        columns: DataTableColumn<TData>[];
        emptyStateCTA?: EmptyPlaceholderCTA;
        emptyStateDescription?: string;
        emptyStateIcon?: string;
        emptyStateTitle?: string;
        filters?: FilterDef[];
        isLoading?: boolean;
        onBulkAction?: (actionId: string, selectedKeys: string[]) => void;
        onParamChange?: (params: DataTableParamChange) => void;
        onRowClick?: (row: TData) => void;
        onSaveView?: () => void;
        pagination?: DataTablePagination;
        remember?: boolean;
        rememberKey?: string;
        rowActions?: DataTableRowAction<TData>[];
        rowKey: keyof TData | ((row: TData) => string);
        rows: TData[];
        savedView?: boolean;
        saveViewLabel?: string;
        searchPlaceholder?: string;
        searchValue?: string;
        selectedRowKey?: string;
        sort?: DataTableSort;
    }

    Type Parameters

    • TData
    Index
    actionsAlwaysVisible?: boolean

    When true, row actions are always visible instead of hover-only.

    appliedFilters?: AppliedFilters

    Currently applied filters.

    bulkActions?: Action[]

    Bulk actions for selected rows.

    Column definitions.

    emptyStateCTA?: EmptyPlaceholderCTA

    Empty state: CTA button.

    emptyStateDescription?: string

    Empty state: description text.

    emptyStateIcon?: string

    Empty state: icon name (kebab-case).

    emptyStateTitle?: string

    Empty state: title text.

    filters?: FilterDef[]

    Available filter definitions.

    isLoading?: boolean

    Whether data is currently loading.

    onBulkAction?: (actionId: string, selectedKeys: string[]) => void

    Callback when a bulk action is triggered. Receives action id + selected row keys.

    onParamChange?: (params: DataTableParamChange) => void

    Callback when any table parameter changes (page, sort, search, filters).

    onRowClick?: (row: TData) => void

    Callback when a row is clicked (e.g. to open inspector).

    onSaveView?: () => void

    Callback for the "save as view" control. The control only renders when this is supplied — a toolbar button that does nothing is worse than no button.

    pagination?: DataTablePagination

    Server-driven pagination state.

    remember?: boolean

    Persist client-only view state (column visibility, density) across Inertia history navigation. Driven by BlockDescriptor.remember from the backend. When false (default), state is plain useState (lost on back/forward).

    rememberKey?: string

    Stable, unique key scoping the remembered state (use block.key).

    rowActions?: DataTableRowAction<TData>[]

    Row-level actions (shown on hover by default).

    rowKey: keyof TData | ((row: TData) => string)

    Unique key extractor for each row. String property name or function.

    rows: TData[]

    Row data.

    savedView?: boolean

    Renders the "save as view" control in its active state.

    saveViewLabel?: string

    Overrides the control's tooltip and accessible name. The consumer decides what saving means here, so it also gets to say so — the built-in "Save as view" would describe the wrong gesture on a page that toggles a favourite.

    searchPlaceholder?: string

    Placeholder for the search input.

    searchValue?: string

    Initial search value (controlled externally).

    selectedRowKey?: string

    Key of the currently selected row (for visual highlight).

    Current sort state.