Table
native table、caption、thead、tbody、tfoot、tr、th、td を組み合わせます。外側の container が overflow-x-auto とニューモーフィックな raised サーフェスを提供します。
@neumorphism-ui/tableプレビュー
| 銘柄 | 価格 | 騰落 | 状態 |
|---|---|---|---|
| NVDA | $181.92 | +2.41% | 取引中 |
| 005930 | ₩72,400 | +1.08% | 選択中 |
| TSLA | $318.27 | −0.64% | 監視 |
インストール
インストール: table
npx shadcn@latest add @neumorphism-ui/tableCLI が npm 依存関係、base token、utils、コンポーネントソースを順番に処理します。
この Registry を初めて使う場合は、先に namespace の設定 を完了してください。
使い方
Import
Table の import コード
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table"Example
Table の使用コード
<Table>
<TableCaption>最近インストールしたコンポーネント</TableCaption>
<TableHeader>
<TableRow>
<TableHead scope="col">コンポーネント</TableHead>
<TableHead scope="col">カテゴリー</TableHead>
<TableHead scope="col">状態</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>Dialog</TableCell>
<TableCell>オーバーレイ</TableCell>
<TableCell>準備完了</TableCell>
</TableRow>
</TableBody>
</Table>API リファレンス
| コンポーネント | プロパティ | 型 | デフォルト | 説明 |
|---|---|---|---|---|
Table | children必須 | React.ReactNode | — | caption と table section を配置します。 |
TableCaption | children | React.ReactNode | — | table の目的とデータ範囲を説明します。 |
TableHead | scope | "col" | "row" | "colgroup" | "rowgroup" | — | header が説明する cell の方向を指定します。 |
TableRow | data-state | "selected" | string | — | 選択された行の inset 状態を有効にします。 |
TableCell | colSpan / rowSpan | number | — | native table cell の span 範囲です。 |
アクセシビリティ
- 01
TableCaption で table の目的を説明し、視覚的に隠す場合は sr-only class を使用してください。
- 02
列と行の header には、意味に応じた scope を設定してください。
- 03
layout だけを目的として Table を使用せず、CSS grid または flex を使用してください。