Filter keys

Raised keys, one down at a time, each with its count; a press squashes the key, and the result count rolls.

Showing 12 of 12 items

Features

  • Raised toggle keys, one down at a time, each carrying its count.
  • A press squashes the key on a playful spring; the count pops only on change, never on first paint.
  • ResultCount says Showing N of M with a rolling N, announced as one sentence.

Use it for

  • Filtering a list by kind.
  • Tabs that carry counts.

On this site

Installation

  1. Get runets.
    git clone https://github.com/ziyam-khan/runets
  2. Copy these files into your project, keeping their folders.
  3. Install what they use.
    pnpm add react motion
  4. Load the styles once. Bring your own base tokens, or use runets’ default theme.
    import 'runets/styles/theme.css'
    import 'runets/styles/kit.css'

API

PropTypeWhat it does
options{ id, label, count, palette? }[]The keys.
value / onChangeidThe key that is down.
labelstringNames the group.
ResultCount shown / total / nounnumber, number, stringThe sentence under the keys.

Accessibility

Source

The code is in src/kit/filter-keys.tsx in runets, MIT licensed.