@gemeente-denhaag/table

中文文档
4.1.3发布于 2026/11/09EUPL-1.2TypeScriptESM + CJS构建来源已验证近 30 天下载 3889

A Table component

原始使用文档
文档目录17 节
  1. When to use
  2. Alternatives and related components
  3. Anatomy
  4. (Interactive) states
  5. Design properties
  6. Typography
  7. Color
  8. Interactive states
  9. Structure
  10. Accessibility
  11. Content guidelines
  12. Best practices
  13. Dos
  14. Don’ts
  15. Custom header widths
  16. Text alignment
  17. References

Table

npm version

Tables organize and display information from a data set into rows and columns.

When to use

Use a table for displaying data that is intended to be easily scanned and compared.

Use lists to create an actionable list of related items that link to details pages, such as a list of customers.

Anatomy

The table consists of:

  1. Caption: describes the table.
  2. Table header: title for the column header.
  3. Table row: the data.

(Interactive) states

The table contains the states normal, hover and focus.

Design properties

Typography

  • Caption: TheMix/xl/700
  • Table header: TheSans/md/700
  • Table row: TheSans/md/400

Color

  • Caption: text color black
  • Column header: text color Grey/4
  • Table row: text color Grey/4

Interactive states

  • Hover: table row background-color Warm/grey
  • Focus: container border color Ocher/5

Structure

  • Table header: padding 16px, margin-top 24px
  • Table row: padding 16px

Accessibility

When tables are used to show data, the header cells that relate to the data cells need to be programmatically linked. This makes table navigation for screen readers less painful.

Simple tables can have up to one level of heading. One row of headers and/or one column of headings. A table with more than one row or more than one column of headings is considered to be a complex table. Each table header cell should have or .

Note: Simple tables with headers in the first row and/or column don’t actually need the scope attribute for assistive technology to read them correctly.

Complex tables are tables with more than two levels of headers. Each header should be given a unique id and each data cell should have a headers attribute with each related header cell’s id listed.

If a table has text associated with it, ensure the text is programmatically linked to the table. This is usually with a element. This element should be the first element under the

element. While a caption is not required, it can be very helpful to screen reader users navigating the page. A caption element is strongly encouraged on data tables as it gives context to the data.

  • Use tables for tabular data. Don’t use it for layout.
  • A table requires a caption element. The summary attribute is deprecated in HTML5.
  • In order to be well-formed and appear in the accessibility tree for assistive technology, a table requires the table head () and table body () elements.

Content guidelines

  • Keep headers informative, descriptive and concise so that they can be read at a glance.
  • Ensure headers include units of measurement symbols so they aren’t repeated throughout the columns.
  • Ensure headers start in a capital letter and don’t end with commas, semicolons or full stops.
  • Ensure content starts in a capital letter and doesn’t include units of measurements.
  • Wrap instead of truncate content. This is because if row titles start with the same word, they’ll all appear the same when truncated.
  • Use decimals consistently.

Best practices

Dos

Tables should:

  • Display a collection of structured data.
  • Have a logical column header.
  • Use a caption to describe a table in the same way you would use a heading. A caption helps users find, navigate and understand tables.
  • Show column/table headers on desktop view and row headers on a mobile view.
  • Only use row headers on desktop if it is going to be used as a list.

Don’ts

Tables should:

  • Not be used when a more complex display of the data or interactions are required.
  • Not position contents on page or lay out a page design. Instead, use Grid.
  • Not necessarily need captions when there is already a heading above the table that describes the data.
  • Not use zebra stripes.

Custom header widths

Use custom widths based on the expected length of the data under each corresponding column. By default the table is full width, however the table can be used with the grid to take up a desired amount of horizontal space on the page.

Text alignment

By default, all the column data should be left-aligned. Use the right alignment for numeric values. This helps the user to identify number size.

  • Align textual data to the left
  • Align numeric values to the right
  • Align numeric data not related to size to the left (ie. date and phone number)
  • Align headers according to their column data
  • Don’t center align.

References

https://designsystem.gov.au/components/table/ https://design.elisa.fi/9b207b2c3/p/1592f3-table/b/62f98d https://inclusive-components.design/data-tables/ https://luna.sainsburys.co.uk/components/tables https://www.a11yproject.com/posts/accessible-data-tables/

版本与发布记录

@gemeente-denhaag/table 共发布 343 个版本,首次发布于 2022/02/09;过去 12 个月发布了 5 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
4.1.3latest2026/11/096 天前
4.1.22026/09/231 个月前
4.1.12026/07/273 个月前
4.1.02026/06/294 个月前
4.0.42025/12/0911 个月前
4.0.32025/11/111 年前

关于 @gemeente-denhaag/table 的常见问题

@gemeente-denhaag/table 是什么?

A Table component

如何安装 @gemeente-denhaag/table?

在项目目录运行 npm install @gemeente-denhaag/table,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(18 || 19)、react-dom(18 || 19)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gemeente-denhaag/table 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gemeente-denhaag/table 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@gemeente-denhaag/table 可以商用吗?

@gemeente-denhaag/table 使用 EUPL-1.2 许可。声明的许可为 EUPL-1.2,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@gemeente-denhaag/table 的下载量有多少?

根据 npm 官方下载统计,@gemeente-denhaag/table 在 2026/10/16 – 2026/11/14 这 30 天内被下载 3,889 次,日均约 130 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gemeente-denhaag/table 还在维护吗?

最新版本 4.1.3 发布于 2026/11/09(6 天前);至今共发布 343 个版本,其中过去 12 个月发布了 5 个;首次发布于 2022/02/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。