@0.1.1 by John Beatty

Sticky Table Header Controller Using Stimulus.js

Score: 90.6

Stimulus Sticky Table Header

This is a simple StimulusJS controller that keeps the header of a table at the top of window as you scroll through the page.


This assumes that StimulusJS is already installed.

Add the stimulus-sticky-table-header module:

$ yarn add stimulus-sticky-table-header


$ npm install stimulus-sticky-table-header

Basic Usage

First, register the controller with StimulusJS:

// application.js
import { Application } from 'stimulus';
import StickyTableHeader from 'stimulus-sticky-table-header';

const application = Application.start();
application.register("sticky-table-header", StickyTableHeader);

Next you need to add the controller's annotations to your table:

<table data-controller="sticky-table-header" 

The controller will handle moving the header as your page scrolls.

The tutorial that this is extracted from can be found here:


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


This package is available as open source under the terms of the MIT License.