Radio group

One of a few, arrow keys move the choice.

Features

  • One choice of a few; the dot pops in on the pop spring.

Use it for

  • Exclusive options.

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 @base-ui/react motion lucide-react
  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'

Usage

import { RadioGroup } from 'runets'

<RadioGroup label="Digest" value={v} onValueChange={setV} options={[['daily', 'Daily'], ['weekly', 'Weekly']]} />

API

PropTypeWhat it does
valuestringThe chosen option.
onValueChange(v) => voidCalled on change.
options[id, label][]The options.

Accessibility

Source

The code is in src/kit/controls.tsx in runets, MIT licensed.