Checkbox#

A focusable boolean toggle with two-way model binding. Enter or Space toggles it.

Import#

TSX
import { Checkbox } from '@sigx/terminal';

Usage#

TSX
/** @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#

PropTypeNotes
modelModel<boolean>two-way bound checked state
labelstringtext beside the box
autofocusbooleangrab focus on mount
disabledbooleannon-interactive

Events#

EventPayloadWhen
changebooleantoggled

Renders with a / marker and a focus accent bar.

See also#