- Name
focusedValue- Kind
- property
- Type
TValue- Requirement
- optional
DocsAPI referenceUI machinestabs
tabs machine
The public state machine contract for @grassroot/ui-machines/tabs. The machine owns behaviour; the matching headless layer owns composition.
@grassroot/ui-machines/tabs
Package
Service example
tabs.tsts
import { createService } from "@grassroot/statechart";import { tabsMachine } from "@grassroot/ui-machines/tabs"; const service = createService(tabsMachine, { input: {} });service.start();service.send({ type: "…" });service.stop();16 of 16
Exports
TabsActivation
typeTabsActivationts
type TabsActivation = "automatic" | "manual";TabsChangeReason
typeTabsChangeReasonts
type TabsChangeReason = "pointer" | "keyboard" | "programmatic";TabsCommand
typeTabsCommandts
type TabsCommand<TValue extends TabsItemValue = string> = CommandObject & ({ readonly type: "VALUE_CHANGE_REQUEST"; readonly value: TValue; readonly reason: TabsChangeReason;} | { readonly type: "FOCUS_ITEM"; readonly key: TValue;});TabsContext
typeTabsContextts
type TabsContext<TValue extends TabsItemValue = string> = { readonly value?: TValue; readonly focusedValue?: TValue; readonly mode: "controlled" | "uncontrolled";};Name
Kind
Type
Requirement
focusedValueproperty
TValueoptional
modeproperty
"controlled" | "uncontrolled"required
valueproperty
TValueoptional
- Name
mode- Kind
- property
- Type
"controlled" | "uncontrolled"- Requirement
- required
- Name
value- Kind
- property
- Type
TValue- Requirement
- optional
TabsDiagnosticCodes
valueTabsDiagnosticCodests
export declare const TabsDiagnosticCodes: readonly DiagnosticCatalogueEntry[];TabsEvent
typeTabsEventts
type TabsEvent<TValue extends TabsItemValue = string> = { readonly type: "SELECT"; readonly value: TValue; readonly reason: TabsChangeReason;} | { readonly type: "MOVE"; readonly direction: -1 | 1;} | { readonly type: "HOME";} | { readonly type: "END";} | { readonly type: "FOCUS"; readonly value: TValue;} | { readonly type: "BLUR";} | { readonly type: "RESET";};TabsInput
typeTabsInputts
type TabsInput<TValue extends TabsItemValue = string> = { readonly tabs: readonly TabsItem<TValue>[]; /** Controlled committed value. Defining it fixes controlled mode at first start. */ readonly value?: TValue; /** Uncontrolled initial committed value. */ readonly defaultValue?: TValue; /** Headless-layer concern; the machine never branches on it. Default "horizontal". */ readonly orientation?: TabsOrientation; /** Default "automatic" — legacy: MOVE/HOME/END select immediately. */ readonly activation?: TabsActivation; /** Default true — legacy wraps at either end. */ readonly loop?: boolean;};Name
Kind
Type
Requirement
Description
activationproperty
TabsActivationoptional
Default "automatic" — legacy: MOVE/HOME/END select immediately.
defaultValueproperty
TValueoptional
Uncontrolled initial committed value.
loopproperty
booleanoptional
Default true — legacy wraps at either end.
orientationproperty
TabsOrientationoptional
Headless-layer concern; the machine never branches on it. Default "horizontal".
tabsproperty
readonly TabsItem<TValue>[]required
—
valueproperty
TValueoptional
Controlled committed value. Defining it fixes controlled mode at first start.
- Name
activation- Kind
- property
- Type
TabsActivation- Requirement
- optional
- Description
- Default "automatic" — legacy: MOVE/HOME/END select immediately.
- Name
defaultValue- Kind
- property
- Type
TValue- Requirement
- optional
- Description
- Uncontrolled initial committed value.
- Name
loop- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- Default true — legacy wraps at either end.
- Name
orientation- Kind
- property
- Type
TabsOrientation- Requirement
- optional
- Description
- Headless-layer concern; the machine never branches on it. Default "horizontal".
- Name
tabs- Kind
- property
- Type
readonly TabsItem<TValue>[]- Requirement
- required
- Description
- —
- Name
value- Kind
- property
- Type
TValue- Requirement
- optional
- Description
- Controlled committed value. Defining it fixes controlled mode at first start.
TabsItem
interfaceTabsItemts
interface TabsItem<TValue extends TabsItemValue = string> { readonly value: TValue; readonly disabled?: boolean;}Name
Kind
Type
Requirement
disabledproperty
booleanoptional
valueproperty
TValuerequired
- Name
disabled- Kind
- property
- Type
boolean- Requirement
- optional
- Name
value- Kind
- property
- Type
TValue- Requirement
- required
TabsItemValue
typeTabsItemValuets
type TabsItemValue = string;tabsMachine
valuetabsMachinets
export declare const tabsMachine: TabsMachine;TabsMachine
typeTabsMachinets
type TabsMachine<TValue extends TabsItemValue = string> = Machine<TabsInput<TValue>, TabsStateValue, TabsContext<TValue>, TabsEvent<TValue>, TabsCommand<TValue>>;TabsOrientation
typeTabsOrientationts
type TabsOrientation = "horizontal" | "vertical";tabsReplaySequence
valuetabsReplaySequencets
export declare const tabsReplaySequence: readonly TabsEvent[];tabsSelectors
valuetabsSelectorsts
export declare const tabsSelectors: { value: (snapshot: TabsSnapshot) => string | undefined; focusedValue: (snapshot: TabsSnapshot) => string | undefined;};Name
Kind
Type
Requirement
focusedValueproperty
(snapshot: TabsSnapshot) => string | undefinedrequired
valueproperty
(snapshot: TabsSnapshot) => string | undefinedrequired
- Name
focusedValue- Kind
- property
- Type
(snapshot: TabsSnapshot) => string | undefined- Requirement
- required
- Name
value- Kind
- property
- Type
(snapshot: TabsSnapshot) => string | undefined- Requirement
- required
TabsSnapshot
typeTabsSnapshotts
type TabsSnapshot<TValue extends TabsItemValue = string> = Snapshot<TabsStateValue, TabsContext<TValue>>;TabsStateValue
typeTabsStateValuets
type TabsStateValue = "ready";