@devtools-ds/table

中文文档
1.2.1发布于 2022/12/28MITTypeScriptESM + CJS近 30 天下载 4982

A flexible table component, modeled after the network inspector in Chrome and FireFox.

原始使用文档
文档目录5 节
  1. Installation
  2. Accessibility Approach
  3. Usage
  4. Resources
  5. Contributors ✨

@devtools-ds/table

A flexible table component, modeled after the network inspector in Chrome and FireFox.

Installation

npm i @devtools-ds/table
# or with yarn
yarn add @devtools-ds/table

Then to use the component in your code just import it!

import { Table } from "@devtools-ds/table";

Accessibility Approach

There isn't a well-established pattern for this interaction, besides being a data grid. However, data grids usually select each cell not the whole row.

I stared by looking at the interactions used in Chrome and FireFox, but they had some issues. In both implementations, the view changes on move without the user selecting a new node, and tab vs. arrow behavior could be unpredictable. For these reasons, I simplified the whole interaction and separated focus from the selected state in the table. Users can navigate focus using tab, arrow keys, or page navigation keys. Selecting a row requires clicking or keyboard entry. Rows are labelled as selected using aria-selected within the grid pattern.

Usage

import { Table } from "@devtools-ds/table";

export const BasicUsage = () => {
  const [selected, setSelected] = React.useState("");
  return (
    <Table
      selected={selected}
      onSelected={(id) => {
        setSelected(id);
      }}
    >
      <Table.Head>
        <Table.Row>
          <Table.HeadCell style={{ width: "10%" }}>Status</Table.HeadCell>
          <Table.HeadCell style={{ width: "10%" }}>Method</Table.HeadCell>
          <Table.HeadCell>Domain</Table.HeadCell>
          <Table.HeadCell>Transferred</Table.HeadCell>
        </Table.Row>
      </Table.Head>
      <Table.Body>
        <Table.Row id="one">
          <Table.Cell>200</Table.Cell>
          <Table.Cell>GET</Table.Cell>
          <Table.Cell>localhost:6006</Table.Cell>
          <Table.Cell>4.6 KB</Table.Cell>
        </Table.Row>
      </Table.Body>
    </Table>
  );
};

Resources

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Tyler Krupicka

📖 🎨 💻 💡 ⚠️

Andrew Lisowski

💻

Adrian de la Rosa

📖 💡 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

版本与发布记录

@devtools-ds/table 共发布 26 个版本,首次发布于 2021/01/25;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.2.1latest2022/12/283 年前
1.2.02022/04/234 年前
1.1.3-canary.23.465.0canary2022/04/234 年前
1.1.3-canary.23.457.02022/04/234 年前
1.1.22021/05/095 年前
1.1.12021/05/085 年前

关于 @devtools-ds/table 的常见问题

@devtools-ds/table 是什么?

A flexible table component, modeled after the network inspector in Chrome and FireFox.

如何安装 @devtools-ds/table?

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

@devtools-ds/table 支持 TypeScript 吗?

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

@devtools-ds/table 支持 ESM 还是 CommonJS?

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

@devtools-ds/table 可以商用吗?

@devtools-ds/table 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@devtools-ds/table 的下载量有多少?

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

@devtools-ds/table 还在维护吗?

最新版本 1.2.1 发布于 2022/12/28(3 年前);至今共发布 26 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/01/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。