DocsAPI referenceUI machinescheckbox

checkbox machine

The public state machine contract for @grassroot/ui-machines/checkbox. The machine owns behaviour; the matching headless layer owns composition.

@grassroot/ui-machines/checkbox

Package

12 exports
View source packages/ui-machines/src/checkbox/index.ts

Service example

checkbox.tsts
import { createService } from "@grassroot/statechart";
import { checkboxMachine } from "@grassroot/ui-machines/checkbox";
const service = createService(checkboxMachine, { input: {} });
service.start();
service.send({ type: "…" });
service.stop();

Exports

DeclarationView source
CheckboxCheckedValuets
type CheckboxCheckedValue = boolean | "indeterminate";
DeclarationView source
CheckboxCommandts
type CheckboxCommand = CommandObject & {
readonly type: "CHECKED_CHANGE_REQUEST";
readonly checked: boolean;
readonly reason: CheckboxReason;
};
Name
Kind
Type
Requirement
checked
property
boolean
required
reason
property
CheckboxReason
required
type
property
string
required
Name
checked
Kind
property
Type
boolean
Requirement
required
Name
reason
Kind
property
Type
CheckboxReason
Requirement
required
Name
type
Kind
property
Type
string
Requirement
required
DeclarationView source
CheckboxContextts
type CheckboxContext = {
readonly mode: BindingMode;
};
Name
Kind
Type
Requirement
mode
property
BindingMode
required
Name
mode
Kind
property
Type
BindingMode
Requirement
required
DeclarationView source
CheckboxDiagnosticCodests
export declare const CheckboxDiagnosticCodes: readonly DiagnosticCatalogueEntry[];
DeclarationView source
CheckboxEventts
type CheckboxEvent = {
readonly type: "TOGGLE";
readonly reason: CheckboxReason;
} | {
readonly type: "RESET";
};
DeclarationView source
CheckboxInputts
type CheckboxInput = {
readonly checked?: CheckboxCheckedValue;
readonly defaultChecked?: CheckboxCheckedValue;
readonly disabled?: boolean;
readonly readOnly?: boolean;
};
Name
Kind
Type
Requirement
checked
property
CheckboxCheckedValue
optional
defaultChecked
property
CheckboxCheckedValue
optional
disabled
property
boolean
optional
readOnly
property
boolean
optional
Name
checked
Kind
property
Type
CheckboxCheckedValue
Requirement
optional
Name
defaultChecked
Kind
property
Type
CheckboxCheckedValue
Requirement
optional
Name
disabled
Kind
property
Type
boolean
Requirement
optional
Name
readOnly
Kind
property
Type
boolean
Requirement
optional
DeclarationView source
checkboxMachinets
export declare const checkboxMachine: Machine<CheckboxInput, CheckboxValue, CheckboxContext, CheckboxEvent, CheckboxCommand>;
DeclarationView source
CheckboxReasonts
type CheckboxReason = "pointer" | "keyboard" | "programmatic";
DeclarationView source
checkboxReplaySequencets
export declare const checkboxReplaySequence: readonly CheckboxEvent[];
DeclarationView source
checkboxSelectorsts
export declare const checkboxSelectors: {
checked: (snapshot: CheckboxSnapshot) => boolean;
indeterminate: (snapshot: CheckboxSnapshot) => boolean;
state: (snapshot: CheckboxSnapshot) => CheckboxValue;
};
Name
Kind
Type
Requirement
checked
property
(snapshot: CheckboxSnapshot) => boolean
required
indeterminate
property
(snapshot: CheckboxSnapshot) => boolean
required
state
property
(snapshot: CheckboxSnapshot) => CheckboxValue
required
Name
checked
Kind
property
Type
(snapshot: CheckboxSnapshot) => boolean
Requirement
required
Name
indeterminate
Kind
property
Type
(snapshot: CheckboxSnapshot) => boolean
Requirement
required
Name
state
Kind
property
Type
(snapshot: CheckboxSnapshot) => CheckboxValue
Requirement
required
DeclarationView source
CheckboxSnapshotts
type CheckboxSnapshot = Snapshot<CheckboxValue, CheckboxContext>;
DeclarationView source
CheckboxValuets
type CheckboxValue = "unchecked" | "checked" | "indeterminate";