charcell 0.1.0
mode

RadioGroup

one choice out of a few, drawn as ( ) and (•).

usage

example

code

import { RadioGroup } from 'charcell/react';

export function RadioGroupExample() {
  return (
    <RadioGroup
      name="gang"
      items={[
        { value: 'polecats', label: 'polecats' },
        { value: 'vultures', label: 'vultures' },
        { value: 'cavefish', label: 'cavefish' },
        { value: 'rottwheelers', label: 'rottwheelers', disabled: true },
      ]}
      label="ride with"
      defaultValue="polecats"
    />
  );
}

as text

at rest
ride with  (•) polecats
           ( ) vultures
           ( ) cavefish
           ( ) rottwheelers
hover
ride with  (•) polecats 
           ( ) vultures
           ( ) cavefish
           ( ) rottwheelers
focus
ride with ❯(•) polecats
           ( ) vultures
           ( ) cavefish
           ( ) rottwheelers

props

namestring
The radios' shared form name; also the root of the label's id.
itemsRadioGroupItem[]
The choices, in order: { value, label, disabled }.
labelstring
The group's name, in the mid gray beside the items.
valuestring
Controlled chosen value (pair with onValueChange).
binds with v-model:value in vue, bind:value in svelte
defaultValuestring
Uncontrolled initial value - the native radios own it from there.
disabledboolean
Disables every radio; the rows rest at mid.
orientation'vertical' | 'horizontal'= 'vertical'
vertical stacks the items; horizontal runs them in a row.
onValueChange(value: string) => void
Called with the chosen value.

it also takes any other attribute of its <div>.