Checkbox and radio
Checkbox, RadioGroup. They are copied into your app’s ui/ by qatjs add checkbox: the code is yours to edit.
Example
Archived shown, delivery std
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| Prop | Type | Attribute |
|---|
checked | boolean | yes |
indeterminate | boolean | yes |
label | QatNode | property only |
description | QatNode | property only |
disabled | boolean | yes |
name | string | yes |
value | string | yes |
Checkbox: events| Event | Detail |
|---|
on:update:checked | CustomEvent<boolean> |
RadioGroup
As a custom element: <ui-radio-group>.
RadioGroup: props| Prop | Type | Attribute |
|---|
options | RadioOption[] | property only |
value | string | yes |
label | QatNode | property only |
variant | 'list' | 'card' | yes |
disabled | boolean | yes |
name | string | yes |
RadioGroup: events| Event | Detail |
|---|
on:update:value | CustomEvent<string> |
Keys
| Key | Does |
|---|
| Space | check |
| ← → ↑ ↓ | move and choose in a radio group |