qat

Checkbox and radio

Checkbox, RadioGroup. They are copied into your app’s ui/ by qatjs add checkbox: the code is yours to edit.

Example

Delivery

Archived shown, delivery std

Example.qx27 lines, 2 reactive namesOpen in the playground
import { Checkbox, RadioGroup } from './ui/checkbox/checkbox.qx'

export default function Example() {
  let archived = state(true)
  let delivery = state('std')
  return (
    <div class="example-grid">
      <div>
        <Checkbox label="Show archived" bind:checked={archived} />
        <Checkbox label="Some rows" indeterminate />
        <Checkbox label="Compact rows" description="36 px instead of 44" />
      </div>
      <RadioGroup
        label="Delivery"
        bind:value={delivery}
        options={[
          { value: 'std', label: 'Standard, 2–3 days' },
          { value: 'exp', label: 'Express, tomorrow' },
          { value: 'pick', label: 'Pickup, unavailable', disabled: true },
        ]}
      />
    </div>
    <p>
      Archived {archived ? 'shown' : 'hidden'}, delivery {delivery}
    </p>
  )
}
archived statedelivery state

Add it

shell1 line
npx qatjs add checkbox

Checkbox

As a custom element: <ui-checkbox>.

Checkbox: props
PropTypeAttribute
checkedbooleanyes
indeterminatebooleanyes
labelQatNodeproperty only
descriptionQatNodeproperty only
disabledbooleanyes
namestringyes
valuestringyes
Checkbox: events
EventDetail
on:update:checkedCustomEvent<boolean>

RadioGroup

As a custom element: <ui-radio-group>.

RadioGroup: props
PropTypeAttribute
optionsRadioOption[]property only
valuestringyes
labelQatNodeproperty only
variant'list' | 'card'yes
disabledbooleanyes
namestringyes
RadioGroup: events
EventDetail
on:update:valueCustomEvent<string>

Keys

KeyDoes
Spacecheck
← → ↑ ↓move and choose in a radio group