DocsAPI referenceUI machinesradio

radio machine

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

@grassroot/ui-machines/radio

Package

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

Service example

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

Exports

DeclarationView source
RadioGroupChangeReasonts
type RadioGroupChangeReason = "pointer" | "keyboard" | "programmatic";
DeclarationView source
RadioGroupCommandts
type RadioGroupCommand = CommandObject & {
readonly type: "VALUE_CHANGE_REQUEST";
readonly value: string;
readonly reason: RadioGroupChangeReason;
};
Name
Kind
Type
Requirement
reason
property
RadioGroupChangeReason
required
type
property
string
required
value
property
string
required
Name
reason
Kind
property
Type
RadioGroupChangeReason
Requirement
required
Name
type
Kind
property
Type
string
Requirement
required
Name
value
Kind
property
Type
string
Requirement
required
DeclarationView source
RadioGroupContextts
type RadioGroupContext = {
readonly mode: BindingMode;
readonly value: string | null;
};
Name
Kind
Type
Requirement
mode
property
BindingMode
required
value
property
string | null
required
Name
mode
Kind
property
Type
BindingMode
Requirement
required
Name
value
Kind
property
Type
string | null
Requirement
required
DeclarationView source
RadioGroupDiagnosticCodests
export declare const RadioGroupDiagnosticCodes: readonly DiagnosticCatalogueEntry[];
DeclarationView source
RadioGroupEventts
type RadioGroupEvent = {
readonly type: "SELECT";
readonly value: string;
readonly reason: RadioGroupChangeReason;
} | {
readonly type: "RESET";
};
DeclarationView source
RadioGroupInputts
type RadioGroupInput = {
/** Controlled committed value. Defining it fixes controlled mode at first start. */
readonly value?: string;
/** Uncontrolled initial committed value. */
readonly defaultValue?: string;
readonly disabled?: boolean;
readonly readOnly?: boolean;
};
Name
Kind
Type
Requirement
Description
defaultValue
property
string
optional
Uncontrolled initial committed value.
disabled
property
boolean
optional
readOnly
property
boolean
optional
value
property
string
optional
Controlled committed value. Defining it fixes controlled mode at first start.
Name
defaultValue
Kind
property
Type
string
Requirement
optional
Description
Uncontrolled initial committed value.
Name
disabled
Kind
property
Type
boolean
Requirement
optional
Description
Name
readOnly
Kind
property
Type
boolean
Requirement
optional
Description
Name
value
Kind
property
Type
string
Requirement
optional
Description
Controlled committed value. Defining it fixes controlled mode at first start.
DeclarationView source
radioGroupMachinets
export declare const radioGroupMachine: RadioGroupMachine;
DeclarationView source
RadioGroupMachinets
type RadioGroupMachine = Machine<RadioGroupInput, RadioGroupStateValue, RadioGroupContext, RadioGroupEvent, RadioGroupCommand>;
DeclarationView source
radioGroupReplaySequencets
export declare const radioGroupReplaySequence: readonly RadioGroupEvent[];
DeclarationView source
radioGroupSelectorsts
export declare const radioGroupSelectors: {
value: (snapshot: RadioGroupSnapshot) => string | null;
isSelected: (snapshot: RadioGroupSnapshot, value: string) => boolean;
};
Name
Kind
Type
Requirement
isSelected
property
(snapshot: RadioGroupSnapshot, value: string) => boolean
required
value
property
(snapshot: RadioGroupSnapshot) => string | null
required
Name
isSelected
Kind
property
Type
(snapshot: RadioGroupSnapshot, value: string) => boolean
Requirement
required
Name
value
Kind
property
Type
(snapshot: RadioGroupSnapshot) => string | null
Requirement
required
DeclarationView source
RadioGroupSnapshotts
type RadioGroupSnapshot = Snapshot<RadioGroupStateValue, RadioGroupContext>;
DeclarationView source
RadioGroupStateValuets
type RadioGroupStateValue = "ready";