Skip to content

DocsNavigationPeriod picker

PT

Navigation

Period picker

Arrows that step through weeks, months or your own list, with the label sliding in from the direction of the click.

data-u="period"

Example

Installation

Period picker ships in the full package, in unslop.css and unslop.js:

curl -fsSL unslop.leallabs.dev/i | sh

A ready-made block that uses period picker:

curl -fsSL unslop.leallabs.dev/i | sh -s add wall-alerts

No build Name-based add is for charts and blocks. Components with JS live in unslop.js, which mounts every data-u on the page by itself.

Props

They go in data-u-props, as JSON.

PropTypeDefaultWhat it does
modestringweeks"month" lists the 12 months and opens on June. Without mode, it's 14 weeks starting in June 2026.
itemsarrayno defaultYour own list of labels. Takes priority over mode.
indexnumberno defaultStarting position.
labelstringPeriodGroup name (aria-label).

Accessibility and keyboard

State and roles

WhereAttributeWhat it says
hostrole="group", aria-labelSet by the JS.
arrowsaria-label, aria-disabled"Previous period" and "Next period". At the end of the list, the arrow gets aria-disabled="true".
labelaria-live="polite"Screen readers announce the new period.

Keyboard

KeyDoes
Tabfocuses the arrows
Enter or Spacemoves one period

Events and API

EventdetailWhen
u:change{ index, label }On every period change. Bars in the same card listen and swap the series.

Every event bubbles up the page. Listen on the element itself: el.addEventListener("u:change", (e) => e.detail).

el._u.index reads the current position.

Type to search. Arrows pick, Enter opens.