Checkbox
A focusable boolean toggle with two-way model binding. Enter or Space toggles it.
Import
import { Checkbox } from '@sigx/terminal';
Usage
/** @jsxImportSource @sigx/terminal */
import { component, defineApp, signal, Checkbox } from '@sigx/terminal';
const App = component(() => {
const agreed = signal(false);
return () => (
<box border="single" label="Terms">
<Checkbox
model={() => agreed}
label="I agree"
autofocus
onChange={(v) => console.log('agreed:', v)}
/>
<br />
<text>{agreed.value ? 'Thank you!' : 'Please accept to continue.'}</text>
</box>
);
});
defineApp(<App />).mount({ clearConsole: true });
Props
| Prop | Type | Notes |
|---|---|---|
model | Model<boolean> | two-way bound checked state |
label | string | text beside the box |
autofocus | boolean | grab focus on mount |
disabled | boolean | non-interactive |
Events
| Event | Payload | When |
|---|---|---|
change | boolean | toggled |
Renders with a ◉ / ◯ marker and a focus accent bar.
See also
- Confirm — yes/no with explicit labels.
- MultiSelect — many checkboxes in a list.
