@cityssm/bulma-sticky-table

中文文档
3.0.2发布于 2026/01/07MITES Module零依赖近 30 天下载 2170

A Bulma-friendly way to stick a table header, table footer, first column, or all three!

原始使用文档
文档目录6 节
  1. Installation
  2. Bulma v1 or newer
  3. Bulma v0.9.4 or older
  4. Usage
  5. Note about .table-container
  6. Thanks

bulma-sticky-table

npm (scoped) Codacy grade

Screenshot

A Bulma-friendly way to stick a table header, table footer, first column, or all three!

See It In Action

Installation

Download a release, or grab the code from npm.

Bulma v1 or newer

npm install @cityssm/bulma-sticky-table

Bulma v0.9.4 or older

npm install @cityssm/[email protected]

Usage

When building your stylesheet, import _sticky-table.scss AFTER you import Bulma. This will ensure your colour customizations are used.

@import 'bulma/bulma';
@import '@cityssm/bulma-sticky-table/sticky-table';

Alternatively, if you are using Bulma without any customizations, you can replace your Bulma stylesheet with bulma-with-sticky-tables.css.

<link
  rel="stylesheet"
  href="path/to/cityssm/bulma-sticky-table/bulma-with-sticky-table.css"
/>

Need a CDN? Check out JS Deliver.

Build your Bulma table as per usual, using the Bulma Table Documentation as your guide.

Then, add any combination of the following classes to your <table> tag.

Use .has-sticky-header to stick the header.

  • Note that the header should be inside of a <thead> tag, and each cell should use a <th> tag.

Use .has-sticky-footer to stick the footer.

  • Note that the footer should be inside of a <tfoot> tag, and each cell should use a <th> tag.

Use .has-sticky-column to stick the first column.

  • Note that the first cells in each table row should use the <th> tag.

Note about .table-container

The Bulma .table-container wraps around a .table to assist with scrolling around large tables. The basic idea is that the container changes the overflow CSS rules on the container. This can affect the .table's ability to stick as you'd expect.

While .has-sticky-column will likely work as expected, .has-sticky-header and .has-sticky-footer may not. There are two options:

  1. Remove the .table-container altogether, and just use the .table as is with the desired sticky classes.

  2. Add some additional styles to the .table-container to change the vertical overflow rule and set a specific height on the container. The example below uses the screen height. Something smaller may be better, depending on your application.

<div class="table-container" style="overflow-y:auto;max-height:100vh;">
  <table>
    <thead>
      ...
    </thead>
    <tbody>
      ...
    </tbody>
  </table>
</div>

Thanks

Made with Bulma

Heavily inspired by code found on CSS-Tricks.

版本与发布记录

@cityssm/bulma-sticky-table 共发布 13 个版本,首次发布于 2021/07/03;过去 12 个月发布了 1 个版本。

版本发布日期距今
3.0.2latest2026/01/0710 个月前
3.0.12025/03/191.6 年前
3.0.02024/05/212 年前
2.1.02023/06/053 年前
2.0.12022/09/204 年前
2.0.02022/09/204 年前

关于 @cityssm/bulma-sticky-table 的常见问题

@cityssm/bulma-sticky-table 是什么?

A Bulma-friendly way to stick a table header, table footer, first column, or all three!

如何安装 @cityssm/bulma-sticky-table?

在项目目录运行 npm install @cityssm/bulma-sticky-table,或使用 pnpm add / yarn add / bun add。

@cityssm/bulma-sticky-table 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/cityssm__bulma-sticky-table 是否存在。

@cityssm/bulma-sticky-table 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@cityssm/bulma-sticky-table 可以商用吗?

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

@cityssm/bulma-sticky-table 的下载量有多少?

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

@cityssm/bulma-sticky-table 还在维护吗?

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