Skip to content

IndexScrubber

An A to Z jump strip beside a long alphabetical list (contacts, countries). One 44px-wide target; dragging shows the letter in a bubble.

  • Pro, mobile
  • Version 2.0.0-rc.1
  • APG pattern: Slider (vertical): Up and Down move a letter, Home and End go to the first and last

Examples

Still previews of the real component, rendered from its stories. Pro code isn’t public, so nothing in them responds. Switch the theme and density for every preview at once.

Default

Showing contacts from A

Section letters only

Show the code

Section letters only, code

<IndexScrubber letters={['A', 'B', 'D', 'G', 'M', 'S', 'Z']} />

Tokens

The 9 design tokens IndexScrubber reads, with the value each has in the theme and density chosen above. Change a token and the component follows, in Figma and in code.

Show all 9 tokens
Tokens IndexScrubber reads
TokenValue nowCSS variable
color.bg.inverse…--sd-color-bg-inverse
color.bg.muted…--sd-color-bg-muted
color.text.brand…--sd-color-text-brand
color.text.default…--sd-color-text-default
color.text.inverse…--sd-color-text-inverse
elevation.2…--sd-elevation-2
radius.full…--sd-radius-full
spacing.inset.xs…--sd-spacing-inset-xs
target.min…--sd-target-min

Install

Pro components come as source from the SuperDuper registry, with a licence key from Solo, Team or Studio. The registry and checkout aren’t open yet.

Add it from the registry (Pro licence key)

npx shadcn@latest add @superduperui/index-scrubber

Then import it

import { IndexScrubber } from "@/components/ui/index-scrubber"

Props

IndexScrubber props
PropTypeWhat it does
lettersstring[]Default [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '#']The index entries, top to bottom: usually the list's section letters. Default A to Z and #.
onChange(letter: string) => voidThe letter to jump to, each time it changes (dragging, or the arrow keys).
aria-labelstringDefault 'Jump to letter'Accessible name. Default "Jump to letter".
classNamestring

When to use it

Use it for

  • Long alphabetical lists with section headings (contacts, countries, an index)

Use something else for

  • Short lists that fit on two screens
  • Lists that are not alphabetical: use SearchField

Accessibility

Screen readers announce "Jump to letter, A, slider".

WCAG 2.2 AAA criteria the component meets in Comfortable density: 1.4.6, 1.4.9, 2.1.3, 2.3.2, 2.4.13, 2.5.5.

Compact density meets AA (2.5.8, 24px targets), not AAA.

What your product still has to do

  • Scroll the list to the section on onChange, and keep the section headings (headings are the main way to move for keyboard and screen reader users)

This release’s test results

Test results for IndexScrubber in this release
axe-core (WCAG A, AA, AAA and best practice)60 runs across every story, theme, density and width: 0 violations
Rendered text contrast405 text runs: 0 below 7:1, lowest 8.4:1
Target size14 targets: 0 under 44px in Comfortable
Focus appearance (2.4.13)18 focus stops in 3 browser engines: all pass
Keyboard scriptChromium 5 of 5, Firefox 5 of 5, WebKit 5 of 5

Manual passes with VoiceOver and NVDA haven’t been done yet.

Keyboard

Each step is scripted and run in Chromium, Firefox and WebKit.

IndexScrubber keyboard steps
KeyWhat happens
TabTab reaches the strip, on the first letter
ArrowDownDown Arrow moves to the next letter
ArrowUpUp Arrow moves to the letter above
EndEnd goes to the last letter
HomeHome goes to the first letter

In Figma

The Figma component is IndexScrubber, with State (Default, Dragging, Focus). The Figma library isn’t published yet.

Figma to code: State (Default, Dragging, Focus; preview only).