本文へ移動
日本語

使い方

import { DashboardTable } from './DashboardTable.jsx'

// Without rows the table shows its sample bakery orders. Your own records, statuses and moves:
<DashboardTable
  locale="en"
  rows={brews.list}   // [{ id, number, name, items: [string | { qty, name }], time, status, total }]
  statuses={[
    { id: 'resting', label: 'Resting', tone: 'progress', pulse: true },
    { id: 'tasted', label: 'Tasted', tone: 'success', icon: 'check' },
    { id: 'binned', label: 'Binned', tone: 'danger', void: true },
  ]}
  actions={[{ id: 'taste', label: 'Mark tasted', from: 'resting', to: 'tasted', icon: 'check' }]}
  columns={{ order: 'Brew', items: 'Recipe', time: 'Brewed', total: 'Score' }}
  format="number"
  labels={{ title: 'Brews this week', search: 'Search brews', searchPlaceholder: 'Bean, number or method' }}
  loading={brews.loading}
  error={brews.error}
  onRetry={brews.reload}
  onStatusChange={async (ids, status) => await brews.move(ids, status)}
/>

プロパティ

プロパティ型既定値説明
locale'en' | 'zh-CN' | 'es' | 'ja''en'組み込みの文言、サンプルの注文、時刻と金額の書式の言語。
rowsArray<{ id, number, name, items: Array<string | { qty, name }>, time, status, total }>sample ordersレコードの配列。`time` は午前0時からの分数か任意の文字列、`status` は `statuses` のいずれかの id。`customer`・`pickup` は `name`・`time` の旧名です。新しい配列を渡すと表を置き換えます。
statusesArray<{ id, label, tone: 'progress' | 'success' | 'warning' | 'danger' | 'neutral', pulse?, icon?, void? }>baking, ready, collected, cancelledタブの順の状態。`pulse` でタグが脈打ち、`icon` は kit のアイコン、`void` は金額を薄くし行を選べなくします。
actionsArray<{ id, label, from: string | string[], to, icon? }>Mark ready, Mark collected選択バーのボタン。選んだ行のうち状態が `from` のものを `to` へ移します。最初のものが主ボタン。空の配列でボタンなし。
columns{ order?, items?, time?, status?, total?: string | false } | Array<{ key, title, render(row), align? }>—オブジェクトで組み込みの列名を変えます(false で品目・時刻・金額の列を隠す)。配列なら独自の列に置き換えます。
format'currency' | 'number' | 'percent' | 'duration' | (value) => string'currency'金額の列の書き方。`currency` の金額、数値、パーセント、秒数の時間、または独自の関数。
currencystringby locale金額に使う ISO 通貨コード。
onStatusChange(ids, status) => Promise<void | false>—`actions` のひとつで選んだ行を進めます(サンプルでは焼成中→受取待ち→受取済み)。false を返すと元のままにします。
loadingbooleanfalse表のスケルトンを表示します。
error / onRetryboolean | string / () => voidfalse再試行ボタン付きのエラーを表示。文字列を渡すと説明を置き換えます。
labelsobject—組み込みの文言を置き換えます(キーは copy.js と同じ)。状態の名前も含みます。

プロジェクトに追加

プロンプトを Codex や Claude Code に貼り付けます。エージェントが公開ソースを読み、書き込むファイルを示してから、使っているコンポーネントと一緒にブロックを追加します。

DashboardTable.jsxdashboard-table.csscopy.jskit.jsxkit.cssui/base-button/ui/empty-state/ui/status-tag/ui/alert-banner/ui/text-input/ui/skeleton-shimmer/ui/sliding-tabs/ui/select-table/tokens.cssREADME.md

ブロック本体、スタイルと文言、共通の kit、使っているコンポーネント、tokens.css が 1 つのフォルダにまとめて入ります。