Skies.ui
元件 (Components)

Table 表格

Skies.ui Table:外層建議 overflow-x-auto,內為語意 table。TableHeader/Body/Footer 對應 thead/tbody/tfoot;TableRow、TableHead、TableCell、TableCaption;樣式與 border-border、muted 一致。

範例與用法

季度概覽(示意)
專案進度
Skies.ui72%
文件站100%
import {
  Table,
  TableBody,
  TableCaption,
  TableCell,
  TableHead,
  TableHeader,
  TableRow,
} from "@skies-ui/ui";

export function Example() {
  return (
    <Table>
      <TableCaption>說明文字</TableCaption>
      <TableHeader>
        <TableRow>
          <TableHead>欄 A</TableHead>
          <TableHead>欄 B</TableHead>
        </TableRow>
      </TableHeader>
      <TableBody>
        <TableRow>
          <TableCell>資料</TableCell>
          <TableCell>資料</TableCell>
        </TableRow>
      </TableBody>
    </Table>
  );
}

not-prose 可避免 Fumadocs 的 typography 覆寫表格字級與邊距。

安裝

npx skies-ui@latest add table

安裝與 CLI

選取列(選用)

TableRow 上使用 data-state="selected" 可套用選取底色(與 Checkbox 同頁表單時常用)。

API 參考

元件對應標籤備註
Tabletable外層捲動容器
TableHeaderthead底部分隔線
TableBodytbody最後列無底框
TableFootertfoot頂部分隔 + muted/50
TableRowtrhover、data-[state=selected]
TableHeadth小字、text-muted-foreground
TableCelltdp-3
TableCaptioncaption下方說明、muted

除需互動的儲存格外,Table 可在 Server Component 使用。

On this page