DataTable
ソート・フィルタ・検索・ページネーション対応のデータテーブル。
インポート
基本的な使い方
Loading...
検索・ソート付き
ヘッダーをクリックしてソート、検索ボックスでフィルタリングできます。
Loading...
フィルター付き
フィルターボタンで条件付きフィルタリングができます。
Loading...
ページネーション付き
Loading...
行アクション付き
各行にアクションボタンを追加できます。
Loading...
カスタムアクション付き
検索ボックスの横にカスタムボタンを追加できます。
Loading...
空状態
データがない場合のカスタム表示。
Loading...
ローディング状態
Loading...
Props
DataTable
| Prop | Type | Default | Description |
|---|---|---|---|
columns* | DataTableColumn[] | - | カラム定義の配列 |
data* | T[] | - | テーブルに表示するデータ |
filterItems | FilterItem[] | - | フィルター項目の配列 |
onFiltersChange | (filters: ActiveFilter[]) => void | - | フィルター変更時のコールバック |
searchPlaceholder | string | '検索...' | 検索ボックスのプレースホルダー |
onSearchChange | (search: string) => void | - | 検索文字列変更時のコールバック |
hideSearch | boolean | false | 検索ボックスを非表示にする |
pagination | PaginationInfo | - | ページネーション設定 |
onPageChange | (page: number) => void | - | ページ変更時のコールバック |
loading | boolean | false | ローディング状態 |
emptyState | { icon, title, description, action } | - | データがない場合の表示設定 |
customActions | ReactNode | - | 検索ボックス横のカスタムアクション |
onRowClick | (item: T) => void | - | 行クリック時のコールバック |
rowActions | (item: T) => ReactNode | - | 各行のアクションレンダラー |
className | string | - | 追加のクラス名 |
DataTableColumn
| Prop | Type | Default | Description |
|---|---|---|---|
id* | string | - | カラムの一意な識別子 |
header* | string | - | ヘッダーに表示するテキスト |
accessorKey | keyof T | - | データオブジェクトのキー |
cell | (data: T) => ReactNode | - | カスタムセルレンダラー |
width | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'auto' | - | カラムの幅 |
sortable | boolean | false | ソート可能にする |
align | 'left' | 'center' | 'right' | 'left' | テキストの配置 |
FilterItem
| Prop | Type | Default | Description |
|---|---|---|---|
id* | string | - | フィルターの一意な識別子 |
label* | string | - | フィルターのラベル |
field* | keyof T | - | フィルター対象のフィールド |
type | 'text' | 'email' | 'phone' | 'url' | 'number' | 'date' | - | フィルタータイプ |
icon | ReactNode | - | カスタムアイコン |
conditions | Array<{ label, condition }> | - | フィルター条件の配列 |
PaginationInfo
| Prop | Type | Default | Description |
|---|---|---|---|
page* | number | - | 現在のページ番号(1始まり) |
limit* | number | - | 1ページあたりの件数 |
total* | number | - | 総件数 |
totalPages* | number | - | 総ページ数 |