charcell 0.1.0
mode

Checkbox

a checkbox drawn as [×], [ ] or [-]. the mark shows the value, so checking it does not invert it.

usage

example

code

import { Checkbox } from 'charcell/react';

export function CheckboxExample() {
  return <Checkbox label="ride with the polecats" defaultChecked />;
}

as text

at rest
 [×] ride with the polecats
hover
 [×] ride with the polecats 
focus
❯[×] ride with the polecats

props

labelstring
The text after the check cell.
checkedboolean
Controlled checked state (pair with onCheckedChange).
binds with v-model:checked in vue, bind:checked in svelte
defaultCheckedboolean
Uncontrolled initial state - the native checkbox owns it from there.
indeterminateboolean
Neither checked nor unchecked, shown as [-]: a box over a set whose members are partly checked. A click clears it.
disabledboolean
Disables the native checkbox; the row rests at mid.
namestring
The form field name.
valuestring
The value the form submits while the box is checked.
idstring
The checkbox's id, for a label elsewhere to point at.
onCheckedChange(checked: boolean) => void
Called with the new checked state on every change.

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

slots

in react, the default slot is children and each named slot a prop of its name, a function where the slot hands values; in vue, a slot; in svelte, a snippet.

default
Content after label, or the whole label without one.