- Name
open- Kind
- property
- Type
boolean- Requirement
- required
DocsAPI referenceUI machinescollapsible
collapsible machine
The public state machine contract for @grassroot/ui-machines/collapsible. The machine owns behaviour; the matching headless layer owns composition.
@grassroot/ui-machines/collapsible
Package
Service example
collapsible.tsts
import { createService } from "@grassroot/statechart";import { collapsibleMachine } from "@grassroot/ui-machines/collapsible"; const service = createService(collapsibleMachine, { input: {} });service.start();service.send({ type: "…" });service.stop();12 of 12
Exports
CollapsibleChangeReasonts
type CollapsibleChangeReason = "pointer" | "keyboard" | "programmatic";CollapsibleCommand
typeCollapsibleCommandts
type CollapsibleCommand = CommandObject & { readonly type: "OPEN_CHANGE_REQUEST"; readonly open: boolean; readonly reason: CollapsibleChangeReason;};Name
Kind
Type
Requirement
openproperty
booleanrequired
reasonproperty
CollapsibleChangeReasonrequired
typeproperty
stringrequired
- Name
reason- Kind
- property
- Type
CollapsibleChangeReason- Requirement
- required
- Name
type- Kind
- property
- Type
string- Requirement
- required
CollapsibleContext
typeCollapsibleContextts
type CollapsibleContext = { readonly mode: "controlled" | "uncontrolled";};Name
Kind
Type
Requirement
modeproperty
"controlled" | "uncontrolled"required
- Name
mode- Kind
- property
- Type
"controlled" | "uncontrolled"- Requirement
- required
CollapsibleDiagnosticCodests
export declare const CollapsibleDiagnosticCodes: readonly DiagnosticCatalogueEntry[];CollapsibleEvent
typeCollapsibleEventts
type CollapsibleEvent = { readonly type: "TOGGLE"; readonly reason: CollapsibleChangeReason;} | { readonly type: "RESET";};CollapsibleInput
typeCollapsibleInputts
type CollapsibleInput = { /** Controlled committed open state. Defining it fixes controlled mode. */ readonly open?: boolean; /** Uncontrolled initial open state. */ readonly defaultOpen?: boolean; /** Disabled prevents user toggles. */ readonly disabled?: boolean;};Name
Kind
Type
Requirement
Description
defaultOpenproperty
booleanoptional
Uncontrolled initial open state.
disabledproperty
booleanoptional
Disabled prevents user toggles.
openproperty
booleanoptional
Controlled committed open state. Defining it fixes controlled mode.
- Name
defaultOpen- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- Uncontrolled initial open state.
- Name
disabled- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- Disabled prevents user toggles.
- Name
open- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- Controlled committed open state. Defining it fixes controlled mode.
collapsibleMachine
valuecollapsibleMachinets
export declare const collapsibleMachine: CollapsibleMachine;CollapsibleMachine
typeCollapsibleMachinets
type CollapsibleMachine = Machine<CollapsibleInput, CollapsibleStateValue, CollapsibleContext, CollapsibleEvent, CollapsibleCommand>;collapsibleReplaySequencets
export declare const collapsibleReplaySequence: readonly CollapsibleEvent[];collapsibleSelectors
valuecollapsibleSelectorsts
export declare const collapsibleSelectors: { open: (snapshot: CollapsibleSnapshot) => boolean;};Name
Kind
Type
Requirement
openproperty
(snapshot: CollapsibleSnapshot) => booleanrequired
- Name
open- Kind
- property
- Type
(snapshot: CollapsibleSnapshot) => boolean- Requirement
- required
CollapsibleSnapshot
typeCollapsibleSnapshotts
type CollapsibleSnapshot = Snapshot<CollapsibleStateValue, CollapsibleContext>;CollapsibleStateValuets
type CollapsibleStateValue = "open" | "closed";