- Name
service- Kind
- parameter
- Type
SwitchService- Requirement
- required
DocsAPI referenceHeadlessswitch
switch headless API
The core connector and vanilla mount are always visible. Use the framework choice to inspect native composition, props, outputs, context and hooks for the selected adapter.
@grassroot/ui-headless-core/switch
Core connector and vanilla API
activateSwitch
functiondeclare function activateSwitch(service: SwitchService, scope: PartScope, options?: SwitchConnectOptions): () => void;serviceSwitchServicescopePartScopeoptionsSwitchConnectOptionsreturn() => void- Name
scope- Kind
- parameter
- Type
PartScope- Requirement
- required
- Name
options- Kind
- parameter
- Type
SwitchConnectOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
() => void- Requirement
- n/a
connectSwitch
functiondeclare function connectSwitch(service: SwitchService, scope: PartScope, options?: SwitchConnectOptions): SwitchApi;serviceSwitchServicescopePartScopeoptionsSwitchConnectOptionsreturnSwitchApi- Name
service- Kind
- parameter
- Type
SwitchService- Requirement
- required
- Name
scope- Kind
- parameter
- Type
PartScope- Requirement
- required
- Name
options- Kind
- parameter
- Type
SwitchConnectOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
SwitchApi- Requirement
- n/a
mountSwitch
functiondeclare function mountSwitch(container: HTMLElement, options?: MountSwitchOptions): SwitchMount;containerHTMLElementoptionsMountSwitchOptionsreturnSwitchMount- Name
container- Kind
- parameter
- Type
HTMLElement- Requirement
- required
- Name
options- Kind
- parameter
- Type
MountSwitchOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
SwitchMount- Requirement
- n/a
MountSwitchOptions
interfaceinterface MountSwitchOptions extends SwitchInput { readonly onCheckedChange?: (detail: SwitchChangeDetail) => void; /** Framework-native passthrough [switch.spec.md #6]. */ readonly onChange?: (event: unknown) => void; readonly name?: string; readonly value?: string; readonly required?: boolean; /** Accessible-name escape hatch [baseline #17]. */ readonly ariaLabel?: string; /** Omits the Label/Description parts entirely (the contract's "bare" scenario) — pair with `ariaLabel`. */ readonly bare?: boolean; /** Render callback for the label's content; default = "Switch" as textContent. Ignored when `bare`. */ readonly renderLabel?: (label: HTMLElement) => void; /** Render callback for the description's content; default = untouched (empty). Ignored when `bare`. */ readonly renderDescription?: (description: HTMLElement) => void;}ariaLabelstringbarebooleannamestringonChange(event: unknown) => voidonCheckedChange(detail: SwitchChangeDetail) => voidrenderDescription(description: HTMLElement) => voidrenderLabel(label: HTMLElement) => voidrequiredbooleanvaluestring- Name
ariaLabel- Kind
- property
- Type
string- Requirement
- optional
- Description
- Accessible-name escape hatch [baseline #17].
- Name
bare- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- Omits the Label/Description parts entirely (the contract's "bare" scenario) — pair with `ariaLabel`.
- Name
name- Kind
- property
- Type
string- Requirement
- optional
- Description
- —
- Name
onChange- Kind
- property
- Type
(event: unknown) => void- Requirement
- optional
- Description
- Framework-native passthrough [switch.spec.md #6].
- Name
onCheckedChange- Kind
- property
- Type
(detail: SwitchChangeDetail) => void- Requirement
- optional
- Description
- —
- Name
renderDescription- Kind
- property
- Type
(description: HTMLElement) => void- Requirement
- optional
- Description
- Render callback for the description's content; default = untouched (empty). Ignored when `bare`.
- Name
renderLabel- Kind
- property
- Type
(label: HTMLElement) => void- Requirement
- optional
- Description
- Render callback for the label's content; default = "Switch" as textContent. Ignored when `bare`.
- Name
required- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- —
- Name
value- Kind
- property
- Type
string- Requirement
- optional
- Description
- —
runSwitchCommand
functionSwitch-shaped command runner — mirrors `runDialogCommand`/ `runTooltipCommand`. Pass this as the `runCommand` option when constructing the Switch `Service` (never called by `connectSwitch` itself). Maps `CHECKED_CHANGE_REQUEST` to exactly one `onCheckedChange({ checked, reason })` [baseline #6, #7] — no adapter compares snapshots to infer the callback.
declare function runSwitchCommand(command: SwitchCommand, options?: SwitchConnectOptions): void;commandSwitchCommandoptionsSwitchConnectOptionsreturnvoid- Name
command- Kind
- parameter
- Type
SwitchCommand- Requirement
- required
- Name
options- Kind
- parameter
- Type
SwitchConnectOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
void- Requirement
- n/a
switchAnatomy
valueexport declare const switchAnatomy: readonly ["root", "hidden-input", "control", "thumb", "label", "description"];SwitchApi
interfaceinterface SwitchApi { rootProps(): PartProps; hiddenInputProps(): PartProps; controlProps(): PartProps; thumbProps(): PartProps; labelProps(): PartProps; descriptionProps(): PartProps; /** Restores the registered hidden input from the committed snapshot; a no-op without DOM. */ syncNativeChecked(): void; readonly checked: boolean; readonly disabled: boolean; readonly readOnly: boolean;}checkedbooleancontrolProps() => PartPropsdescriptionProps() => PartPropsdisabledbooleanlabelProps() => PartPropsreadOnlybooleanrootProps() => PartPropssyncNativeChecked() => voidthumbProps() => PartProps- Name
checked- Kind
- property
- Type
boolean- Requirement
- required
- Description
- —
- Name
controlProps- Kind
- method
- Type
() => PartProps- Requirement
- required
- Description
- —
- Name
descriptionProps- Kind
- method
- Type
() => PartProps- Requirement
- required
- Description
- —
- Name
disabled- Kind
- property
- Type
boolean- Requirement
- required
- Description
- —
- Name
hiddenInputProps- Kind
- method
- Type
() => PartProps- Requirement
- required
- Description
- —
- Name
labelProps- Kind
- method
- Type
() => PartProps- Requirement
- required
- Description
- —
- Name
readOnly- Kind
- property
- Type
boolean- Requirement
- required
- Description
- —
- Name
rootProps- Kind
- method
- Type
() => PartProps- Requirement
- required
- Description
- —
- Name
syncNativeChecked- Kind
- method
- Type
() => void- Requirement
- required
- Description
- Restores the registered hidden input from the committed snapshot; a no-op without DOM.
- Name
thumbProps- Kind
- method
- Type
() => PartProps- Requirement
- required
- Description
- —
SwitchChangeDetail
interfaceinterface SwitchChangeDetail { readonly checked: boolean; readonly reason: SwitchChangeReason;}checkedbooleanreasonSwitchChangeReason- Name
checked- Kind
- property
- Type
boolean- Requirement
- required
- Name
reason- Kind
- property
- Type
SwitchChangeReason- Requirement
- required
SwitchChangeReason
typetype SwitchChangeReason = "pointer" | "keyboard" | "programmatic";SwitchCommand
typetype SwitchCommand = CommandObject & { readonly type: "CHECKED_CHANGE_REQUEST"; readonly checked: boolean; readonly reason: SwitchChangeReason;};checkedbooleanreasonSwitchChangeReasontypestring- Name
checked- Kind
- property
- Type
boolean- Requirement
- required
- Name
reason- Kind
- property
- Type
SwitchChangeReason- Requirement
- required
- Name
type- Kind
- property
- Type
string- Requirement
- required
SwitchConnectOptions
interfaceinterface SwitchConnectOptions { readonly onCheckedChange?: (detail: SwitchChangeDetail) => void; /** Framework-native passthrough [switch.spec.md #6] — never used to infer `onCheckedChange`. */ readonly onChange?: (event: unknown) => void; readonly name?: string; readonly value?: string; readonly required?: boolean; /** Accessible-name escape hatch [baseline #17]. */ readonly ariaLabel?: string;}ariaLabelstringnamestringonChange(event: unknown) => voidonCheckedChange(detail: SwitchChangeDetail) => voidrequiredbooleanvaluestring- Name
ariaLabel- Kind
- property
- Type
string- Requirement
- optional
- Description
- Accessible-name escape hatch [baseline #17].
- Name
name- Kind
- property
- Type
string- Requirement
- optional
- Description
- —
- Name
onChange- Kind
- property
- Type
(event: unknown) => void- Requirement
- optional
- Description
- Framework-native passthrough [switch.spec.md #6] — never used to infer `onCheckedChange`.
- Name
onCheckedChange- Kind
- property
- Type
(detail: SwitchChangeDetail) => void- Requirement
- optional
- Description
- —
- Name
required- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- —
- Name
value- Kind
- property
- Type
string- Requirement
- optional
- Description
- —
SwitchContext
typetype SwitchContext = { readonly mode: "controlled" | "uncontrolled";};mode"controlled" | "uncontrolled"- Name
mode- Kind
- property
- Type
"controlled" | "uncontrolled"- Requirement
- required
SwitchEvent
typetype SwitchEvent = { readonly type: "PRESS"; readonly reason: SwitchChangeReason;} | { readonly type: "RESET";};SwitchInput
typetype SwitchInput = { readonly checked?: boolean; readonly defaultChecked?: boolean; readonly disabled?: boolean; readonly readOnly?: boolean;};checkedbooleandefaultCheckedbooleandisabledbooleanreadOnlyboolean- Name
checked- Kind
- property
- Type
boolean- Requirement
- optional
- Name
defaultChecked- Kind
- property
- Type
boolean- Requirement
- optional
- Name
disabled- Kind
- property
- Type
boolean- Requirement
- optional
- Name
readOnly- Kind
- property
- Type
boolean- Requirement
- optional
switchMachine
valueexport declare const switchMachine: Machine<SwitchInput, SwitchValue, SwitchContext, SwitchEvent, SwitchCommand>;SwitchMount
interfaceinterface SwitchMount { readonly service: SwitchService; readonly connector: SwitchApi; readonly root: HTMLElement; readonly input: HTMLInputElement; readonly control: HTMLElement; readonly thumb: HTMLElement; readonly label: HTMLElement | null; readonly description: HTMLElement | null; destroy(): void;}connectorSwitchApicontrolHTMLElementdescriptionHTMLElement | nulldestroy() => voidinputHTMLInputElementlabelHTMLElement | nullrootHTMLElementserviceSwitchServicethumbHTMLElement- Name
connector- Kind
- property
- Type
SwitchApi- Requirement
- required
- Name
control- Kind
- property
- Type
HTMLElement- Requirement
- required
- Name
description- Kind
- property
- Type
HTMLElement | null- Requirement
- required
- Name
destroy- Kind
- method
- Type
() => void- Requirement
- required
- Name
input- Kind
- property
- Type
HTMLInputElement- Requirement
- required
- Name
label- Kind
- property
- Type
HTMLElement | null- Requirement
- required
- Name
root- Kind
- property
- Type
HTMLElement- Requirement
- required
- Name
service- Kind
- property
- Type
SwitchService- Requirement
- required
- Name
thumb- Kind
- property
- Type
HTMLElement- Requirement
- required
SwitchPart
typetype SwitchPart = (typeof switchAnatomy)[number];switchSelectors
valueexport declare const switchSelectors: { checked: (snapshot: SwitchSnapshot) => boolean;};checked(snapshot: SwitchSnapshot) => boolean- Name
checked- Kind
- property
- Type
(snapshot: SwitchSnapshot) => boolean- Requirement
- required
SwitchService
typetype SwitchService = Service<SwitchInput, SwitchValue, SwitchContext, SwitchEvent, SwitchCommand>;SwitchSnapshot
typetype SwitchSnapshot = Snapshot<SwitchValue, SwitchContext>;SwitchValue
typetype SwitchValue = "unchecked" | "checked";Framework adapters
Each panel keeps its adapter's public vocabulary. React compound exports, Vue composables, standalone Angular declarations, Svelte components, and Solid hooks stay native to their framework.
React imports
import { Control, Description, Label, Root, RootProvider, Switch, Thumb } from "@grassroot/ui-headless-react/switch";Vue imports
<script setup lang="ts">import { SwitchControl, SwitchDescription, SwitchLabel, SwitchRoot, SwitchRootProvider, SwitchThumb } from "@grassroot/ui-headless-vue/switch";</script>Angular imports
import { Component } from "@angular/core";import { GR_SWITCH_DECLARATIONS } from "@grassroot/ui-headless-angular/switch"; @Component({ standalone: true, imports: [GR_SWITCH_DECLARATIONS], template: `<!-- compose the switch parts here -->` })export class Example {}Svelte imports
<script lang="ts"> import { SwitchControl, SwitchDescription, SwitchLabel, SwitchRoot, SwitchRootProvider, SwitchThumb } from "@grassroot/ui-headless-svelte/switch";</script>Solid imports
import { SwitchControl, SwitchDescription, SwitchLabel, SwitchRoot, SwitchRootProvider, SwitchThumb } from "@grassroot/ui-headless-solid/switch";@grassroot/ui-headless-react/switch
React adapter
Control
valueexport declare const Control: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean;} & import("react").RefAttributes<HTMLSpanElement>>;propsPreturnReactNode- Name
props- Kind
- parameter
- Type
P- Requirement
- required
- Name
return- Kind
- return value
- Type
ReactNode- Requirement
- n/a
Description
valueexport declare const Description: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean;} & import("react").RefAttributes<HTMLSpanElement>>;propsPreturnReactNode- Name
props- Kind
- parameter
- Type
P- Requirement
- required
- Name
return- Kind
- return value
- Type
ReactNode- Requirement
- n/a
Label
valueexport declare const Label: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean;} & import("react").RefAttributes<HTMLSpanElement>>;propsPreturnReactNode- Name
props- Kind
- parameter
- Type
P- Requirement
- required
- Name
return- Kind
- return value
- Type
ReactNode- Requirement
- n/a
Root
valueexport declare const Root: import("react").ForwardRefExoticComponent<SwitchRootProps & import("react").RefAttributes<HTMLLabelElement>>;propsPreturnReactNode- Name
props- Kind
- parameter
- Type
P- Requirement
- required
- Name
return- Kind
- return value
- Type
ReactNode- Requirement
- n/a
RootProvider
valueexport declare const RootProvider: import("react").ForwardRefExoticComponent<SwitchRootProviderProps & import("react").RefAttributes<HTMLLabelElement>>;propsPreturnReactNode- Name
props- Kind
- parameter
- Type
P- Requirement
- required
- Name
return- Kind
- return value
- Type
ReactNode- Requirement
- n/a
Switch
valueexport declare const Switch: { Root: import("react").ForwardRefExoticComponent<SwitchRootProps & import("react").RefAttributes<HTMLLabelElement>>; RootProvider: import("react").ForwardRefExoticComponent<SwitchRootProviderProps & import("react").RefAttributes<HTMLLabelElement>>; HiddenInput: import("react").ForwardRefExoticComponent<SwitchHiddenInputProps & import("react").RefAttributes<HTMLInputElement>>; Control: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean; } & import("react").RefAttributes<HTMLSpanElement>>; Thumb: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean; } & import("react").RefAttributes<HTMLSpanElement>>; Label: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean; } & import("react").RefAttributes<HTMLSpanElement>>; Description: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean; } & import("react").RefAttributes<HTMLSpanElement>>;};Controlimport("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
asChild?: boolean;
} & import("react").RefAttributes<HTMLSpanElement>>Descriptionimport("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
asChild?: boolean;
} & import("react").RefAttributes<HTMLSpanElement>>HiddenInputimport("react").ForwardRefExoticComponent<SwitchHiddenInputProps & import("react").RefAttributes<HTMLInputElement>>Labelimport("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
asChild?: boolean;
} & import("react").RefAttributes<HTMLSpanElement>>Rootimport("react").ForwardRefExoticComponent<SwitchRootProps & import("react").RefAttributes<HTMLLabelElement>>RootProviderimport("react").ForwardRefExoticComponent<SwitchRootProviderProps & import("react").RefAttributes<HTMLLabelElement>>Thumbimport("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
asChild?: boolean;
} & import("react").RefAttributes<HTMLSpanElement>>- Name
Control- Kind
- property
- Type
import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean; } & import("react").RefAttributes<HTMLSpanElement>>- Requirement
- required
- Name
Description- Kind
- property
- Type
import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean; } & import("react").RefAttributes<HTMLSpanElement>>- Requirement
- required
- Name
HiddenInput- Kind
- property
- Type
import("react").ForwardRefExoticComponent<SwitchHiddenInputProps & import("react").RefAttributes<HTMLInputElement>>- Requirement
- required
- Name
Label- Kind
- property
- Type
import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean; } & import("react").RefAttributes<HTMLSpanElement>>- Requirement
- required
- Name
Root- Kind
- property
- Type
import("react").ForwardRefExoticComponent<SwitchRootProps & import("react").RefAttributes<HTMLLabelElement>>- Requirement
- required
- Name
RootProvider- Kind
- property
- Type
import("react").ForwardRefExoticComponent<SwitchRootProviderProps & import("react").RefAttributes<HTMLLabelElement>>- Requirement
- required
- Name
Thumb- Kind
- property
- Type
import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean; } & import("react").RefAttributes<HTMLSpanElement>>- Requirement
- required
SwitchContext
valueexport declare const SwitchContext: import("react").Context<SwitchContextValue | null>;propsPreturnReactNode- Name
props- Kind
- parameter
- Type
P- Requirement
- required
- Name
return- Kind
- return value
- Type
ReactNode- Requirement
- n/a
SwitchContextValue
interfaceinterface SwitchContextValue { readonly service: SwitchService; readonly connector: SwitchApi; readonly scope: PartScope;}connectorSwitchApiscopePartScopeserviceSwitchService- Name
connector- Kind
- property
- Type
SwitchApi- Requirement
- required
- Name
scope- Kind
- property
- Type
PartScope- Requirement
- required
- Name
service- Kind
- property
- Type
SwitchService- Requirement
- required
SwitchRootProps
interfaceinterface SwitchRootProps extends Omit<ComponentPropsWithoutRef<"label">, "defaultChecked" | "checked" | "disabled" | "onChange"> { readonly asChild?: boolean; readonly checked?: SwitchInput["checked"]; readonly defaultChecked?: SwitchInput["defaultChecked"]; readonly disabled?: SwitchInput["disabled"]; readonly readOnly?: SwitchInput["readOnly"]; readonly name?: string; readonly value?: string; readonly required?: boolean; /** Accessible-name escape hatch [baseline #17] — see `Switch.Label` for the primary path. */ readonly ariaLabel?: string; /** * Seeds the part scope INSTEAD of the generated id when supplied * [baseline #10]: `<Switch.Root id="wifi">` yields deterministic * `hidden-input`/`label`/`description` ids derived from `"wifi"`. Feeds * `useSwitch`'s `id` option — see that hook's doc comment. Intercepted * here rather than left in the native passthrough, so it configures the * scope seed instead of landing on the rendered `<label>` as a plain * HTML `id` attribute. */ readonly id?: string; readonly onCheckedChange?: (detail: SwitchChangeDetail) => void; readonly onChange?: (event: ChangeEvent<HTMLInputElement>) => void; readonly children?: ReactNode;}ariaLabelstringasChildbooleancheckedSwitchInput["checked"]childrenReactNodedefaultCheckedSwitchInput["defaultChecked"]disabledSwitchInput["disabled"]idstringnamestringonChange(event: ChangeEvent<HTMLInputElement>) => voidonCheckedChange(detail: SwitchChangeDetail) => voidreadOnlySwitchInput["readOnly"]requiredbooleanvaluestring- Name
ariaLabel- Kind
- property
- Type
string- Requirement
- optional
- Description
- Accessible-name escape hatch [baseline #17] — see `Switch.Label` for the primary path.
- Name
asChild- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- —
- Name
checked- Kind
- property
- Type
SwitchInput["checked"]- Requirement
- optional
- Description
- —
- Name
children- Kind
- property
- Type
ReactNode- Requirement
- optional
- Description
- —
- Name
defaultChecked- Kind
- property
- Type
SwitchInput["defaultChecked"]- Requirement
- optional
- Description
- —
- Name
disabled- Kind
- property
- Type
SwitchInput["disabled"]- Requirement
- optional
- Description
- —
- Name
id- Kind
- property
- Type
string- Requirement
- optional
- Description
- Seeds the part scope INSTEAD of the generated id when supplied [baseline #10]: `<Switch.Root id="wifi">` yields deterministic `hidden-input`/`label`/`description` ids derived from `"wifi"`. Feeds `useSwitch`'s `id` option — see that hook's doc comment. Intercepted here rather than left in the native passthrough, so it configures the scope seed instead of landing on the rendered `<label>` as a plain HTML `id` attribute.
- Name
name- Kind
- property
- Type
string- Requirement
- optional
- Description
- —
- Name
onChange- Kind
- property
- Type
(event: ChangeEvent<HTMLInputElement>) => void- Requirement
- optional
- Description
- —
- Name
onCheckedChange- Kind
- property
- Type
(detail: SwitchChangeDetail) => void- Requirement
- optional
- Description
- —
- Name
readOnly- Kind
- property
- Type
SwitchInput["readOnly"]- Requirement
- optional
- Description
- —
- Name
required- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- —
- Name
value- Kind
- property
- Type
string- Requirement
- optional
- Description
- —
SwitchRootProviderProps
interfaceinterface SwitchRootProviderProps extends Omit<ComponentPropsWithoutRef<"label">, "defaultChecked" | "checked" | "disabled" | "onChange" | "value"> { readonly asChild?: boolean; /** An existing `useSwitch()` result (advanced composition) — already fully configured. */ readonly value: UseSwitchResult; readonly children?: ReactNode;}asChildbooleanchildrenReactNodevalueUseSwitchResult- Name
asChild- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- —
- Name
children- Kind
- property
- Type
ReactNode- Requirement
- optional
- Description
- —
- Name
value- Kind
- property
- Type
UseSwitchResult- Requirement
- required
- Description
- An existing `useSwitch()` result (advanced composition) — already fully configured.
Thumb
valueexport declare const Thumb: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & { asChild?: boolean;} & import("react").RefAttributes<HTMLSpanElement>>;propsPreturnReactNode- Name
props- Kind
- parameter
- Type
P- Requirement
- required
- Name
return- Kind
- return value
- Type
ReactNode- Requirement
- n/a
useSwitch
functiondeclare function useSwitch(input: SwitchInput, options?: UseSwitchOptions): UseSwitchResult;inputSwitchInputoptionsUseSwitchOptionsreturnUseSwitchResult- Name
input- Kind
- parameter
- Type
SwitchInput- Requirement
- required
- Name
options- Kind
- parameter
- Type
UseSwitchOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
UseSwitchResult- Requirement
- n/a
useSwitchContext
functiondeclare function useSwitchContext(partName: string): SwitchContextValue;partNamestringreturnSwitchContextValue- Name
partName- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
SwitchContextValue- Requirement
- n/a
UseSwitchOptions
interfaceinterface UseSwitchOptions { readonly onCheckedChange?: (detail: SwitchChangeDetail) => void; readonly onChange?: (event: ChangeEvent<HTMLInputElement>) => void; readonly name?: string; readonly value?: string; readonly required?: boolean; readonly ariaLabel?: string; readonly id?: string;}ariaLabelstringidstringnamestringonChange(event: ChangeEvent<HTMLInputElement>) => voidonCheckedChange(detail: SwitchChangeDetail) => voidrequiredbooleanvaluestring- Name
ariaLabel- Kind
- property
- Type
string- Requirement
- optional
- Name
id- Kind
- property
- Type
string- Requirement
- optional
- Name
name- Kind
- property
- Type
string- Requirement
- optional
- Name
onChange- Kind
- property
- Type
(event: ChangeEvent<HTMLInputElement>) => void- Requirement
- optional
- Name
onCheckedChange- Kind
- property
- Type
(detail: SwitchChangeDetail) => void- Requirement
- optional
- Name
required- Kind
- property
- Type
boolean- Requirement
- optional
- Name
value- Kind
- property
- Type
string- Requirement
- optional
UseSwitchResult
interfaceinterface UseSwitchResult { readonly service: SwitchService; readonly connector: SwitchApi; readonly scope: PartScope; readonly snapshot: SwitchSnapshot;}connectorSwitchApiscopePartScopeserviceSwitchServicesnapshotSwitchSnapshot- Name
connector- Kind
- property
- Type
SwitchApi- Requirement
- required
- Name
scope- Kind
- property
- Type
PartScope- Requirement
- required
- Name
service- Kind
- property
- Type
SwitchService- Requirement
- required
- Name
snapshot- Kind
- property
- Type
SwitchSnapshot- Requirement
- required
@grassroot/ui-headless-vue/switch
Vue adapter
SwitchContextKey
valueexport declare const SwitchContextKey: InjectionKey<SwitchContextValue>;SwitchContextValue
interfaceinterface SwitchContextValue { readonly service: SwitchService; readonly connector: SwitchApi; readonly scope: PartScope; /** Bumped on every committed machine update; parts read `.value` to establish a reactive dependency. */ readonly snapshot: ShallowRef<SwitchSnapshot>;}connectorSwitchApiscopePartScopeserviceSwitchServicesnapshotShallowRef<SwitchSnapshot>- Name
connector- Kind
- property
- Type
SwitchApi- Requirement
- required
- Description
- —
- Name
scope- Kind
- property
- Type
PartScope- Requirement
- required
- Description
- —
- Name
service- Kind
- property
- Type
SwitchService- Requirement
- required
- Description
- —
- Name
snapshot- Kind
- property
- Type
ShallowRef<SwitchSnapshot>- Requirement
- required
- Description
- Bumped on every committed machine update; parts read `.value` to establish a reactive dependency.
SwitchControl
valueexport declare const SwitchControl: import("vue").DefineComponent<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; };}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any;}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; };}>> & Readonly<{}>, { asChild: boolean;}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;SwitchDescription
valueexport declare const SwitchDescription: import("vue").DefineComponent<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; };}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any;}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; };}>> & Readonly<{}>, { asChild: boolean;}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;SwitchLabel
valueexport declare const SwitchLabel: import("vue").DefineComponent<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; };}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any;}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; };}>> & Readonly<{}>, { asChild: boolean;}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;SwitchRoot
valueexport declare const SwitchRoot: import("vue").DefineComponent<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; }; checked: { type: PropType<SwitchInput["checked"]>; default: undefined; }; defaultChecked: { type: PropType<SwitchInput["defaultChecked"]>; default: undefined; }; disabled: { type: PropType<SwitchInput["disabled"]>; default: undefined; }; readOnly: { type: PropType<SwitchInput["readOnly"]>; default: undefined; }; name: { type: PropType<string | undefined>; default: undefined; }; value: { type: PropType<string | undefined>; default: undefined; }; required: { type: PropType<boolean | undefined>; default: undefined; }; /** Accessible-name escape hatch [baseline #17] — see `SwitchLabel` for the primary path. */ ariaLabel: { type: PropType<string | undefined>; default: undefined; }; /** * Seeds the part scope INSTEAD of the generated id when supplied * [baseline #10]: `<SwitchRoot id="wifi">` yields deterministic * `hidden-input`/`label`/`description` ids derived from `"wifi"`. Feeds * `useSwitch`'s `id` option — see that composable's doc comment. Declared * as a real prop (not left to fall through to `attrs`) so it configures * the scope seed instead of landing on the rendered `<label>` as a plain * HTML `id` attribute. */ id: { type: PropType<string | undefined>; default: undefined; };}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any;}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, { checkedChange: (_detail: SwitchChangeDetail) => true;}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; }; checked: { type: PropType<SwitchInput["checked"]>; default: undefined; }; defaultChecked: { type: PropType<SwitchInput["defaultChecked"]>; default: undefined; }; disabled: { type: PropType<SwitchInput["disabled"]>; default: undefined; }; readOnly: { type: PropType<SwitchInput["readOnly"]>; default: undefined; }; name: { type: PropType<string | undefined>; default: undefined; }; value: { type: PropType<string | undefined>; default: undefined; }; required: { type: PropType<boolean | undefined>; default: undefined; }; /** Accessible-name escape hatch [baseline #17] — see `SwitchLabel` for the primary path. */ ariaLabel: { type: PropType<string | undefined>; default: undefined; }; /** * Seeds the part scope INSTEAD of the generated id when supplied * [baseline #10]: `<SwitchRoot id="wifi">` yields deterministic * `hidden-input`/`label`/`description` ids derived from `"wifi"`. Feeds * `useSwitch`'s `id` option — see that composable's doc comment. Declared * as a real prop (not left to fall through to `attrs`) so it configures * the scope seed instead of landing on the rendered `<label>` as a plain * HTML `id` attribute. */ id: { type: PropType<string | undefined>; default: undefined; };}>> & Readonly<{ onCheckedChange?: ((_detail: SwitchChangeDetail) => any) | undefined;}>, { asChild: boolean; checked: boolean | undefined; defaultChecked: boolean | undefined; disabled: boolean | undefined; readOnly: boolean | undefined; name: string | undefined; value: string | undefined; required: boolean | undefined; ariaLabel: string | undefined; id: string | undefined;}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;SwitchRootProvider
valueexport declare const SwitchRootProvider: import("vue").DefineComponent<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; }; /** An existing `useSwitch()` result (advanced composition) — already fully configured. */ value: { type: PropType<UseSwitchResult>; required: true; };}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any;}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; }; /** An existing `useSwitch()` result (advanced composition) — already fully configured. */ value: { type: PropType<UseSwitchResult>; required: true; };}>> & Readonly<{}>, { asChild: boolean;}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;SwitchThumb
valueexport declare const SwitchThumb: import("vue").DefineComponent<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; };}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, { [key: string]: any;}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{ asChild: { type: BooleanConstructor; default: boolean; };}>> & Readonly<{}>, { asChild: boolean;}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;useSwitch
functiondeclare function useSwitch(input: SwitchInput | (() => SwitchInput), options?: UseSwitchOptions | (() => UseSwitchOptions)): UseSwitchResult;inputSwitchInput | (() => SwitchInput)optionsUseSwitchOptions | (() => UseSwitchOptions)returnUseSwitchResult- Name
input- Kind
- parameter
- Type
SwitchInput | (() => SwitchInput)- Requirement
- required
- Name
options- Kind
- parameter
- Type
UseSwitchOptions | (() => UseSwitchOptions)- Requirement
- optional
- Name
return- Kind
- return value
- Type
UseSwitchResult- Requirement
- n/a
useSwitchContext
functiondeclare function useSwitchContext(partName: string): SwitchContextValue;partNamestringreturnSwitchContextValue- Name
partName- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
SwitchContextValue- Requirement
- n/a
UseSwitchOptions
interfaceinterface UseSwitchOptions { readonly onCheckedChange?: (detail: SwitchChangeDetail) => void; readonly onChange?: (event: Event) => void; readonly name?: string; readonly value?: string; readonly required?: boolean; readonly ariaLabel?: string; readonly id?: string;}ariaLabelstringidstringnamestringonChange(event: Event) => voidonCheckedChange(detail: SwitchChangeDetail) => voidrequiredbooleanvaluestring- Name
ariaLabel- Kind
- property
- Type
string- Requirement
- optional
- Name
id- Kind
- property
- Type
string- Requirement
- optional
- Name
name- Kind
- property
- Type
string- Requirement
- optional
- Name
onChange- Kind
- property
- Type
(event: Event) => void- Requirement
- optional
- Name
onCheckedChange- Kind
- property
- Type
(detail: SwitchChangeDetail) => void- Requirement
- optional
- Name
required- Kind
- property
- Type
boolean- Requirement
- optional
- Name
value- Kind
- property
- Type
string- Requirement
- optional
UseSwitchResult
interfaceinterface UseSwitchResult { readonly service: SwitchService; readonly connector: SwitchApi; readonly scope: PartScope; readonly snapshot: ShallowRef<SwitchSnapshot>;}connectorSwitchApiscopePartScopeserviceSwitchServicesnapshotShallowRef<SwitchSnapshot>- Name
connector- Kind
- property
- Type
SwitchApi- Requirement
- required
- Name
scope- Kind
- property
- Type
PartScope- Requirement
- required
- Name
service- Kind
- property
- Type
SwitchService- Requirement
- required
- Name
snapshot- Kind
- property
- Type
ShallowRef<SwitchSnapshot>- Requirement
- required
@grassroot/ui-headless-angular/switch
Angular adapter
createSwitchStore
functionexport declare function createSwitchStore(initialInput: SwitchInput, options?: CreateSwitchStoreOptions): SwitchStore;initialInputSwitchInputoptionsCreateSwitchStoreOptionsreturnSwitchStore- Name
initialInput- Kind
- parameter
- Type
SwitchInput- Requirement
- required
- Name
options- Kind
- parameter
- Type
CreateSwitchStoreOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
SwitchStore- Requirement
- n/a
CreateSwitchStoreOptions
interfaceexport interface CreateSwitchStoreOptions { readonly onCheckedChange?: (detail: SwitchChangeDetail) => void; readonly onChange?: (event: unknown) => void; readonly onCommit?: () => void; readonly id?: string;}idstringonChange(event: unknown) => voidonCheckedChange(detail: SwitchChangeDetail) => voidonCommit() => void- Name
id- Kind
- property
- Type
string- Requirement
- optional
- Name
onChange- Kind
- property
- Type
(event: unknown) => void- Requirement
- optional
- Name
onCheckedChange- Kind
- property
- Type
(detail: SwitchChangeDetail) => void- Requirement
- optional
- Name
onCommit- Kind
- property
- Type
() => void- Requirement
- optional
GR_SWITCH_DECLARATIONS
valueexport declare const GR_SWITCH_DECLARATIONS: readonly [typeof GrSwitchRoot, typeof GrSwitchRootProvider, typeof GrSwitchHiddenInput, typeof GrSwitchControl, typeof GrSwitchThumb, typeof GrSwitchLabel, typeof GrSwitchDescription];GrSwitchControl
classexport declare class GrSwitchControl implements OnDestroy { private readonly store; private readonly elementRef; private readonly listeners; private readonly consumerProps; constructor(); ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<GrSwitchControl, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<GrSwitchControl, "[grSwitchControl]", never, {}, {}, never, never, true, never>;}consumerPropsanyelementRefanylistenersanyngOnDestroy() => voidɵdiri0.ɵɵDirectiveDeclaration<GrSwitchControl, "[grSwitchControl]", never, {}, {}, never, never, true, never>ɵfaci0.ɵɵFactoryDeclaration<GrSwitchControl, never>storeany- Name
consumerProps- Kind
- property
- Type
any- Requirement
- required
- Name
elementRef- Kind
- property
- Type
any- Requirement
- required
- Name
listeners- Kind
- property
- Type
any- Requirement
- required
- Name
ngOnDestroy- Kind
- method
- Type
() => void- Requirement
- required
- Name
ɵdir- Kind
- property
- Type
i0.ɵɵDirectiveDeclaration<GrSwitchControl, "[grSwitchControl]", never, {}, {}, never, never, true, never>- Requirement
- required
- Name
ɵfac- Kind
- property
- Type
i0.ɵɵFactoryDeclaration<GrSwitchControl, never>- Requirement
- required
- Name
store- Kind
- property
- Type
any- Requirement
- required
GrSwitchDescription
classexport declare class GrSwitchDescription implements OnDestroy { private readonly store; private readonly elementRef; private readonly listeners; private readonly consumerProps; constructor(); ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<GrSwitchDescription, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<GrSwitchDescription, "[grSwitchDescription]", never, {}, {}, never, never, true, never>;}consumerPropsanyelementRefanylistenersanyngOnDestroy() => voidɵdiri0.ɵɵDirectiveDeclaration<GrSwitchDescription, "[grSwitchDescription]", never, {}, {}, never, never, true, never>ɵfaci0.ɵɵFactoryDeclaration<GrSwitchDescription, never>storeany- Name
consumerProps- Kind
- property
- Type
any- Requirement
- required
- Name
elementRef- Kind
- property
- Type
any- Requirement
- required
- Name
listeners- Kind
- property
- Type
any- Requirement
- required
- Name
ngOnDestroy- Kind
- method
- Type
() => void- Requirement
- required
- Name
ɵdir- Kind
- property
- Type
i0.ɵɵDirectiveDeclaration<GrSwitchDescription, "[grSwitchDescription]", never, {}, {}, never, never, true, never>- Requirement
- required
- Name
ɵfac- Kind
- property
- Type
i0.ɵɵFactoryDeclaration<GrSwitchDescription, never>- Requirement
- required
- Name
store- Kind
- property
- Type
any- Requirement
- required
GrSwitchLabel
classexport declare class GrSwitchLabel implements OnDestroy { private readonly store; private readonly elementRef; private readonly listeners; private readonly consumerProps; constructor(); ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<GrSwitchLabel, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<GrSwitchLabel, "[grSwitchLabel]", never, {}, {}, never, never, true, never>;}consumerPropsanyelementRefanylistenersanyngOnDestroy() => voidɵdiri0.ɵɵDirectiveDeclaration<GrSwitchLabel, "[grSwitchLabel]", never, {}, {}, never, never, true, never>ɵfaci0.ɵɵFactoryDeclaration<GrSwitchLabel, never>storeany- Name
consumerProps- Kind
- property
- Type
any- Requirement
- required
- Name
elementRef- Kind
- property
- Type
any- Requirement
- required
- Name
listeners- Kind
- property
- Type
any- Requirement
- required
- Name
ngOnDestroy- Kind
- method
- Type
() => void- Requirement
- required
- Name
ɵdir- Kind
- property
- Type
i0.ɵɵDirectiveDeclaration<GrSwitchLabel, "[grSwitchLabel]", never, {}, {}, never, never, true, never>- Requirement
- required
- Name
ɵfac- Kind
- property
- Type
i0.ɵɵFactoryDeclaration<GrSwitchLabel, never>- Requirement
- required
- Name
store- Kind
- property
- Type
any- Requirement
- required
GrSwitchRoot
classexport declare class GrSwitchRoot implements OnDestroy { readonly checked: import("@angular/core").InputSignal<boolean | undefined>; readonly defaultChecked: import("@angular/core").InputSignal<boolean | undefined>; readonly disabled: import("@angular/core").InputSignal<boolean | undefined>; readonly readOnly: import("@angular/core").InputSignal<boolean | undefined>; readonly name: import("@angular/core").InputSignal<string | undefined>; readonly value: import("@angular/core").InputSignal<string | undefined>; readonly required: import("@angular/core").InputSignal<boolean | undefined>; /** Accessible-name escape hatch [baseline #17] — see `GrSwitchLabel` for the primary path. */ readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>; /** * Seeds the part scope INSTEAD of the generated id when supplied * [baseline #10]: `<gr-switch-root id="wifi">` yields deterministic * `hidden-input`/`label`/`description` ids derived from `"wifi"`. Feeds * `createSwitchStore`'s `id` option (constructor-only — see that * function's doc comment); read once, in the constructor below, unlike * `name`/`value`/`required`/`ariaLabel`, which stay live via * `setConnectOptions()`. */ readonly id: import("@angular/core").InputSignal<string | undefined>; readonly checkedChange: import("@angular/core").OutputEmitterRef<SwitchChangeDetail>; private readonly hostElementRef; private readonly injector; private readonly listeners; private lastSynced; readonly store: SwitchStore; private rootElement; constructor(); ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<GrSwitchRoot, never>; static ɵcmp: i0.ɵɵComponentDeclaration<GrSwitchRoot, "gr-switch-root", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "defaultChecked": { "alias": "defaultChecked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; }, { "checkedChange": "checkedChange"; }, never, ["*"], true, never>;}ariaLabelimport("@angular/core").InputSignal<string | undefined>checkedimport("@angular/core").InputSignal<boolean | undefined>checkedChangeimport("@angular/core").OutputEmitterRef<SwitchChangeDetail>defaultCheckedimport("@angular/core").InputSignal<boolean | undefined>disabledimport("@angular/core").InputSignal<boolean | undefined>hostElementRefanyidimport("@angular/core").InputSignal<string | undefined>injectoranylastSyncedanylistenersanynameimport("@angular/core").InputSignal<string | undefined>ngOnDestroy() => voidɵcmpi0.ɵɵComponentDeclaration<GrSwitchRoot, "gr-switch-root", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "defaultChecked": { "alias": "defaultChecked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; }, { "checkedChange": "checkedChange"; }, never, ["*"], true, never>ɵfaci0.ɵɵFactoryDeclaration<GrSwitchRoot, never>- Name
ariaLabel- Kind
- property
- Type
import("@angular/core").InputSignal<string | undefined>- Requirement
- required
- Description
- Accessible-name escape hatch [baseline #17] — see `GrSwitchLabel` for the primary path.
- Name
checked- Kind
- property
- Type
import("@angular/core").InputSignal<boolean | undefined>- Requirement
- required
- Description
- —
- Name
checkedChange- Kind
- property
- Type
import("@angular/core").OutputEmitterRef<SwitchChangeDetail>- Requirement
- required
- Description
- —
- Name
defaultChecked- Kind
- property
- Type
import("@angular/core").InputSignal<boolean | undefined>- Requirement
- required
- Description
- —
- Name
disabled- Kind
- property
- Type
import("@angular/core").InputSignal<boolean | undefined>- Requirement
- required
- Description
- —
- Name
hostElementRef- Kind
- property
- Type
any- Requirement
- required
- Description
- —
- Name
id- Kind
- property
- Type
import("@angular/core").InputSignal<string | undefined>- Requirement
- required
- Description
- Seeds the part scope INSTEAD of the generated id when supplied [baseline #10]: `<gr-switch-root id="wifi">` yields deterministic `hidden-input`/`label`/`description` ids derived from `"wifi"`. Feeds `createSwitchStore`'s `id` option (constructor-only — see that function's doc comment); read once, in the constructor below, unlike `name`/`value`/`required`/`ariaLabel`, which stay live via `setConnectOptions()`.
- Name
injector- Kind
- property
- Type
any- Requirement
- required
- Description
- —
- Name
lastSynced- Kind
- property
- Type
any- Requirement
- required
- Description
- —
- Name
listeners- Kind
- property
- Type
any- Requirement
- required
- Description
- —
- Name
name- Kind
- property
- Type
import("@angular/core").InputSignal<string | undefined>- Requirement
- required
- Description
- —
- Name
ngOnDestroy- Kind
- method
- Type
() => void- Requirement
- required
- Description
- —
- Name
ɵcmp- Kind
- property
- Type
i0.ɵɵComponentDeclaration<GrSwitchRoot, "gr-switch-root", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "defaultChecked": { "alias": "defaultChecked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; }, { "checkedChange": "checkedChange"; }, never, ["*"], true, never>- Requirement
- required
- Description
- —
- Name
ɵfac- Kind
- property
- Type
i0.ɵɵFactoryDeclaration<GrSwitchRoot, never>- Requirement
- required
- Description
- —
- Name
readOnly- Kind
- property
- Type
import("@angular/core").InputSignal<boolean | undefined>- Requirement
- required
- Description
- —
- Name
required- Kind
- property
- Type
import("@angular/core").InputSignal<boolean | undefined>- Requirement
- required
- Description
- —
- Name
rootElement- Kind
- property
- Type
any- Requirement
- required
- Description
- —
- Name
store- Kind
- property
- Type
SwitchStore- Requirement
- required
- Description
- —
- Name
value- Kind
- property
- Type
import("@angular/core").InputSignal<string | undefined>- Requirement
- required
- Description
- —
GrSwitchRootProvider
classexport declare class GrSwitchRootProvider implements OnDestroy { private readonly hostElementRef; private readonly injector; private readonly listeners; readonly store: SwitchStore; private rootElement; constructor(); ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<GrSwitchRootProvider, never>; static ɵcmp: i0.ɵɵComponentDeclaration<GrSwitchRootProvider, "gr-switch-root-provider", never, {}, {}, never, ["*"], true, never>;}hostElementRefanyinjectoranylistenersanyngOnDestroy() => voidɵcmpi0.ɵɵComponentDeclaration<GrSwitchRootProvider, "gr-switch-root-provider", never, {}, {}, never, ["*"], true, never>ɵfaci0.ɵɵFactoryDeclaration<GrSwitchRootProvider, never>rootElementanystoreSwitchStore- Name
hostElementRef- Kind
- property
- Type
any- Requirement
- required
- Name
injector- Kind
- property
- Type
any- Requirement
- required
- Name
listeners- Kind
- property
- Type
any- Requirement
- required
- Name
ngOnDestroy- Kind
- method
- Type
() => void- Requirement
- required
- Name
ɵcmp- Kind
- property
- Type
i0.ɵɵComponentDeclaration<GrSwitchRootProvider, "gr-switch-root-provider", never, {}, {}, never, ["*"], true, never>- Requirement
- required
- Name
ɵfac- Kind
- property
- Type
i0.ɵɵFactoryDeclaration<GrSwitchRootProvider, never>- Requirement
- required
- Name
rootElement- Kind
- property
- Type
any- Requirement
- required
- Name
store- Kind
- property
- Type
SwitchStore- Requirement
- required
GrSwitchThumb
classexport declare class GrSwitchThumb implements OnDestroy { private readonly store; private readonly elementRef; private readonly listeners; private readonly consumerProps; constructor(); ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<GrSwitchThumb, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<GrSwitchThumb, "[grSwitchThumb]", never, {}, {}, never, never, true, never>;}consumerPropsanyelementRefanylistenersanyngOnDestroy() => voidɵdiri0.ɵɵDirectiveDeclaration<GrSwitchThumb, "[grSwitchThumb]", never, {}, {}, never, never, true, never>ɵfaci0.ɵɵFactoryDeclaration<GrSwitchThumb, never>storeany- Name
consumerProps- Kind
- property
- Type
any- Requirement
- required
- Name
elementRef- Kind
- property
- Type
any- Requirement
- required
- Name
listeners- Kind
- property
- Type
any- Requirement
- required
- Name
ngOnDestroy- Kind
- method
- Type
() => void- Requirement
- required
- Name
ɵdir- Kind
- property
- Type
i0.ɵɵDirectiveDeclaration<GrSwitchThumb, "[grSwitchThumb]", never, {}, {}, never, never, true, never>- Requirement
- required
- Name
ɵfac- Kind
- property
- Type
i0.ɵɵFactoryDeclaration<GrSwitchThumb, never>- Requirement
- required
- Name
store- Kind
- property
- Type
any- Requirement
- required
provideSwitchStore
functionexport declare function provideSwitchStore(initialInput?: SwitchInput, options?: CreateSwitchStoreOptions): Provider;initialInputSwitchInputoptionsCreateSwitchStoreOptionsreturnProvider- Name
initialInput- Kind
- parameter
- Type
SwitchInput- Requirement
- optional
- Name
options- Kind
- parameter
- Type
CreateSwitchStoreOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
Provider- Requirement
- n/a
SWITCH_STORE
valueexport declare const SWITCH_STORE: InjectionToken<SwitchStore>;SwitchChangeDetail
interfaceexport interface SwitchChangeDetail { readonly checked: boolean; readonly reason: SwitchChangeReason;}checkedbooleanreasonSwitchChangeReason- Name
checked- Kind
- property
- Type
boolean- Requirement
- required
- Name
reason- Kind
- property
- Type
SwitchChangeReason- Requirement
- required
SwitchConnectOptionsPatch
interfaceexport interface SwitchConnectOptionsPatch { readonly name?: string; readonly value?: string; readonly required?: boolean; readonly ariaLabel?: string;}ariaLabelstringnamestringrequiredbooleanvaluestring- Name
ariaLabel- Kind
- property
- Type
string- Requirement
- optional
- Name
name- Kind
- property
- Type
string- Requirement
- optional
- Name
required- Kind
- property
- Type
boolean- Requirement
- optional
- Name
value- Kind
- property
- Type
string- Requirement
- optional
SwitchStore
interfaceexport interface SwitchStore { readonly service: SwitchService; readonly connector: SwitchApi; readonly scope: PartScope; /** * Bumped on every committed machine update — AND, defensively, once by * `GrSwitchLabel`/`GrSwitchDescription` right after they self-register * (see `parts.ts`). Effects that read the connector's prop bags must read * this signal first — inside the same `effect()` — so Angular's * reactivity re-runs the effect on every committed change (the staleness * bug class called out across every other adapter) AND so * `GrSwitchHiddenInput`'s `aria-labelledby`/`aria-describedby` (resolved * from `scope.get("label"/"description")` at getter-call time) settle * once those parts exist, even if some future template change ever * managed to construct them after the hidden input's own first effect * flush. */ readonly version: WritableSignal<number>; /** Starts the underlying service and runs `activateSwitch` (idempotent) — call from the browser only. */ start(): void; /** Stops the underlying service and releases `activateSwitch`'s cleanup (idempotent). */ stop(): void; /** Forwards a new committed input to the machine (no-op on the very first call). */ sync(input: SwitchInput): void; /** * Updates the connector's live `name`/`value`/`required`/`ariaLabel` * reading (see `use-switch.ts`'s header comment for why this exists * instead of a one-shot constructor-time value). */ setConnectOptions(next: SwitchConnectOptionsPatch): void;}connectorSwitchApiscopePartScopeserviceSwitchServicesetConnectOptions(next: SwitchConnectOptionsPatch) => voidstart() => voidstop() => voidsync(input: SwitchInput) => voidversionWritableSignal<number>- Name
connector- Kind
- property
- Type
SwitchApi- Requirement
- required
- Description
- —
- Name
scope- Kind
- property
- Type
PartScope- Requirement
- required
- Description
- —
- Name
service- Kind
- property
- Type
SwitchService- Requirement
- required
- Description
- —
- Name
setConnectOptions- Kind
- method
- Type
(next: SwitchConnectOptionsPatch) => void- Requirement
- required
- Description
- Updates the connector's live `name`/`value`/`required`/`ariaLabel` reading (see `use-switch.ts`'s header comment for why this exists instead of a one-shot constructor-time value).
- Name
start- Kind
- method
- Type
() => void- Requirement
- required
- Description
- Starts the underlying service and runs `activateSwitch` (idempotent) — call from the browser only.
- Name
stop- Kind
- method
- Type
() => void- Requirement
- required
- Description
- Stops the underlying service and releases `activateSwitch`'s cleanup (idempotent).
- Name
sync- Kind
- method
- Type
(input: SwitchInput) => void- Requirement
- required
- Description
- Forwards a new committed input to the machine (no-op on the very first call).
- Name
version- Kind
- property
- Type
WritableSignal<number>- Requirement
- required
- Description
- Bumped on every committed machine update — AND, defensively, once by `GrSwitchLabel`/`GrSwitchDescription` right after they self-register (see `parts.ts`). Effects that read the connector's prop bags must read this signal first — inside the same `effect()` — so Angular's reactivity re-runs the effect on every committed change (the staleness bug class called out across every other adapter) AND so `GrSwitchHiddenInput`'s `aria-labelledby`/`aria-describedby` (resolved from `scope.get("label"/"description")` at getter-call time) settle once those parts exist, even if some future template change ever managed to construct them after the hidden input's own first effect flush.
@grassroot/ui-headless-svelte/switch
Svelte adapter
createSwitch
functionexport declare function createSwitch(inputGetter: () => SwitchInput, optionsGetter?: () => UseSwitchOptions): UseSwitchResult;inputGetter() => SwitchInputoptionsGetter() => UseSwitchOptionsreturnUseSwitchResult- Name
inputGetter- Kind
- parameter
- Type
() => SwitchInput- Requirement
- required
- Name
optionsGetter- Kind
- parameter
- Type
() => UseSwitchOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
UseSwitchResult- Requirement
- n/a
SwitchChangeDetail
interfaceinterface SwitchChangeDetail { readonly checked: boolean; readonly reason: SwitchChangeReason;}checkedbooleanreasonSwitchChangeReason- Name
checked- Kind
- property
- Type
boolean- Requirement
- required
- Name
reason- Kind
- property
- Type
SwitchChangeReason- Requirement
- required
SwitchChangeReason
typetype SwitchChangeReason = "pointer" | "keyboard" | "programmatic";SwitchCommand
typetype SwitchCommand = CommandObject & { readonly type: "CHECKED_CHANGE_REQUEST"; readonly checked: boolean; readonly reason: SwitchChangeReason;};checkedbooleanreasonSwitchChangeReasontypestring- Name
checked- Kind
- property
- Type
boolean- Requirement
- required
- Name
reason- Kind
- property
- Type
SwitchChangeReason- Requirement
- required
- Name
type- Kind
- property
- Type
string- Requirement
- required
SwitchContext
typetype SwitchContext = { readonly mode: "controlled" | "uncontrolled";};mode"controlled" | "uncontrolled"- Name
mode- Kind
- property
- Type
"controlled" | "uncontrolled"- Requirement
- required
SwitchContextValue
interfaceexport interface SwitchContextValue { readonly service: SwitchService; readonly connector: SwitchApi; readonly scope: PartScope; /** * Bumped on every committed machine update. Parts must read this * (`ctx.version()`) *inside* the `$derived` that computes their prop * bag — not once at setup — so Svelte's fine-grained reactivity tracks * the dependency and recomputes on every committed change (mirrors the * Dialog/Tooltip adapters' equivalent staleness fix). */ readonly version: () => number;}connectorSwitchApiscopePartScopeserviceSwitchServiceversion() => number- Name
connector- Kind
- property
- Type
SwitchApi- Requirement
- required
- Description
- —
- Name
scope- Kind
- property
- Type
PartScope- Requirement
- required
- Description
- —
- Name
service- Kind
- property
- Type
SwitchService- Requirement
- required
- Description
- —
- Name
version- Kind
- property
- Type
() => number- Requirement
- required
- Description
- Bumped on every committed machine update. Parts must read this (`ctx.version()`) *inside* the `$derived` that computes their prop bag — not once at setup — so Svelte's fine-grained reactivity tracks the dependency and recomputes on every committed change (mirrors the Dialog/Tooltip adapters' equivalent staleness fix).
SwitchControl
valueexport declare const SwitchControl: LegacyComponentType;argsParameters<Component<Record<string, any>>>returnReturnType<Component<Record<string, any>, Record<string, any>>>- Name
args- Kind
- parameter
- Type
Parameters<Component<Record<string, any>>>- Requirement
- optional
- Name
return- Kind
- return value
- Type
ReturnType<Component<Record<string, any>, Record<string, any>>>- Requirement
- n/a
SwitchDescription
valueexport declare const SwitchDescription: LegacyComponentType;argsParameters<Component<Record<string, any>>>returnReturnType<Component<Record<string, any>, Record<string, any>>>- Name
args- Kind
- parameter
- Type
Parameters<Component<Record<string, any>>>- Requirement
- optional
- Name
return- Kind
- return value
- Type
ReturnType<Component<Record<string, any>, Record<string, any>>>- Requirement
- n/a
SwitchEvent
typetype SwitchEvent = { readonly type: "PRESS"; readonly reason: SwitchChangeReason;} | { readonly type: "RESET";};SwitchInput
typetype SwitchInput = { readonly checked?: boolean; readonly defaultChecked?: boolean; readonly disabled?: boolean; readonly readOnly?: boolean;};checkedbooleandefaultCheckedbooleandisabledbooleanreadOnlyboolean- Name
checked- Kind
- property
- Type
boolean- Requirement
- optional
- Name
defaultChecked- Kind
- property
- Type
boolean- Requirement
- optional
- Name
disabled- Kind
- property
- Type
boolean- Requirement
- optional
- Name
readOnly- Kind
- property
- Type
boolean- Requirement
- optional
SwitchLabel
valueexport declare const SwitchLabel: LegacyComponentType;argsParameters<Component<Record<string, any>>>returnReturnType<Component<Record<string, any>, Record<string, any>>>- Name
args- Kind
- parameter
- Type
Parameters<Component<Record<string, any>>>- Requirement
- optional
- Name
return- Kind
- return value
- Type
ReturnType<Component<Record<string, any>, Record<string, any>>>- Requirement
- n/a
SwitchRoot
valueexport declare const SwitchRoot: LegacyComponentType;argsParameters<Component<Record<string, any>>>returnReturnType<Component<Record<string, any>, Record<string, any>>>- Name
args- Kind
- parameter
- Type
Parameters<Component<Record<string, any>>>- Requirement
- optional
- Name
return- Kind
- return value
- Type
ReturnType<Component<Record<string, any>, Record<string, any>>>- Requirement
- n/a
SwitchRootProvider
valueexport declare const SwitchRootProvider: LegacyComponentType;argsParameters<Component<Record<string, any>>>returnReturnType<Component<Record<string, any>, Record<string, any>>>- Name
args- Kind
- parameter
- Type
Parameters<Component<Record<string, any>>>- Requirement
- optional
- Name
return- Kind
- return value
- Type
ReturnType<Component<Record<string, any>, Record<string, any>>>- Requirement
- n/a
SwitchSnapshot
typetype SwitchSnapshot = Snapshot<SwitchValue, SwitchContext>;SwitchThumb
valueexport declare const SwitchThumb: LegacyComponentType;argsParameters<Component<Record<string, any>>>returnReturnType<Component<Record<string, any>, Record<string, any>>>- Name
args- Kind
- parameter
- Type
Parameters<Component<Record<string, any>>>- Requirement
- optional
- Name
return- Kind
- return value
- Type
ReturnType<Component<Record<string, any>, Record<string, any>>>- Requirement
- n/a
SwitchValue
typetype SwitchValue = "unchecked" | "checked";useSwitchContext
functionexport declare function useSwitchContext(partName: string): SwitchContextValue;partNamestringreturnSwitchContextValue- Name
partName- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
SwitchContextValue- Requirement
- n/a
UseSwitchOptions
interfaceexport interface UseSwitchOptions { readonly onCheckedChange?: (detail: SwitchChangeDetail) => void; readonly onChange?: (event: Event) => void; readonly name?: string; readonly value?: string; readonly required?: boolean; readonly ariaLabel?: string; readonly id?: string;}ariaLabelstringidstringnamestringonChange(event: Event) => voidonCheckedChange(detail: SwitchChangeDetail) => voidrequiredbooleanvaluestring- Name
ariaLabel- Kind
- property
- Type
string- Requirement
- optional
- Name
id- Kind
- property
- Type
string- Requirement
- optional
- Name
name- Kind
- property
- Type
string- Requirement
- optional
- Name
onChange- Kind
- property
- Type
(event: Event) => void- Requirement
- optional
- Name
onCheckedChange- Kind
- property
- Type
(detail: SwitchChangeDetail) => void- Requirement
- optional
- Name
required- Kind
- property
- Type
boolean- Requirement
- optional
- Name
value- Kind
- property
- Type
string- Requirement
- optional
UseSwitchResult
interfaceexport interface UseSwitchResult { readonly service: SwitchService; readonly connector: SwitchApi; readonly scope: PartScope; readonly version: () => number;}connectorSwitchApiscopePartScopeserviceSwitchServiceversion() => number- Name
connector- Kind
- property
- Type
SwitchApi- Requirement
- required
- Name
scope- Kind
- property
- Type
PartScope- Requirement
- required
- Name
service- Kind
- property
- Type
SwitchService- Requirement
- required
- Name
version- Kind
- property
- Type
() => number- Requirement
- required
@grassroot/ui-headless-solid/switch
Solid adapter
SwitchConnectConfig
interfaceexport interface SwitchConnectConfig { readonly name?: string; readonly value?: string; readonly required?: boolean; readonly ariaLabel?: string;}ariaLabelstringnamestringrequiredbooleanvaluestring- Name
ariaLabel- Kind
- property
- Type
string- Requirement
- optional
- Name
name- Kind
- property
- Type
string- Requirement
- optional
- Name
required- Kind
- property
- Type
boolean- Requirement
- optional
- Name
value- Kind
- property
- Type
string- Requirement
- optional
SwitchContext
valueexport declare const SwitchContext: import("solid-js").Context<SwitchContextValue | undefined>;SwitchContextValue
interfaceexport interface SwitchContextValue { readonly service: SwitchService; readonly connector: SwitchApi; readonly scope: PartScope; /** * Bumped on every committed machine update. Parts must call this * accessor *inside* the JSX/spread thunk that reads the connector's prop * bags — not once at setup — so Solid's fine-grained reactivity tracks * the dependency and re-runs on every committed change. */ readonly snapshot: Accessor<SwitchSnapshot>; /** * Solid-adapter-internal: `SwitchHiddenInput` reads this alongside * `snapshot()` to resettle `aria-labelledby`/`aria-describedby` once * `SwitchLabel`/`SwitchDescription` (if rendered) have registered, and to * pick up `name`/`value`/`required`/`ariaLabel` changes — see * `use-switch.ts`'s `relationshipTick` header comment. */ readonly relationshipTick: Accessor<number>;}connectorSwitchApirelationshipTickAccessor<number>scopePartScopeserviceSwitchServicesnapshotAccessor<SwitchSnapshot>- Name
connector- Kind
- property
- Type
SwitchApi- Requirement
- required
- Description
- —
- Name
relationshipTick- Kind
- property
- Type
Accessor<number>- Requirement
- required
- Description
- Solid-adapter-internal: `SwitchHiddenInput` reads this alongside `snapshot()` to resettle `aria-labelledby`/`aria-describedby` once `SwitchLabel`/`SwitchDescription` (if rendered) have registered, and to pick up `name`/`value`/`required`/`ariaLabel` changes — see `use-switch.ts`'s `relationshipTick` header comment.
- Name
scope- Kind
- property
- Type
PartScope- Requirement
- required
- Description
- —
- Name
service- Kind
- property
- Type
SwitchService- Requirement
- required
- Description
- —
- Name
snapshot- Kind
- property
- Type
Accessor<SwitchSnapshot>- Requirement
- required
- Description
- Bumped on every committed machine update. Parts must call this accessor *inside* the JSX/spread thunk that reads the connector's prop bags — not once at setup — so Solid's fine-grained reactivity tracks the dependency and re-runs on every committed change.
SwitchControl
valueexport declare const SwitchControl: (props: SwitchPartProps) => JSX.Element;propsSwitchPartPropsreturnJSX.Element- Name
props- Kind
- parameter
- Type
SwitchPartProps- Requirement
- required
- Name
return- Kind
- return value
- Type
JSX.Element- Requirement
- n/a
SwitchDescription
valueexport declare const SwitchDescription: (props: SwitchPartProps) => JSX.Element;propsSwitchPartPropsreturnJSX.Element- Name
props- Kind
- parameter
- Type
SwitchPartProps- Requirement
- required
- Name
return- Kind
- return value
- Type
JSX.Element- Requirement
- n/a
SwitchLabel
valueexport declare const SwitchLabel: (props: SwitchPartProps) => JSX.Element;propsSwitchPartPropsreturnJSX.Element- Name
props- Kind
- parameter
- Type
SwitchPartProps- Requirement
- required
- Name
return- Kind
- return value
- Type
JSX.Element- Requirement
- n/a
SwitchPartProps
interfaceexport interface SwitchPartProps extends JSX.HTMLAttributes<HTMLSpanElement> {}SwitchRoot
functionexport declare function SwitchRoot(props: SwitchRootProps): JSX.Element;propsSwitchRootPropsreturnJSX.Element- Name
props- Kind
- parameter
- Type
SwitchRootProps- Requirement
- required
- Name
return- Kind
- return value
- Type
JSX.Element- Requirement
- n/a
SwitchRootProps
interfaceexport interface SwitchRootProps extends Omit<JSX.LabelHTMLAttributes<HTMLLabelElement>, "onChange"> { readonly checked?: SwitchInput["checked"]; readonly defaultChecked?: SwitchInput["defaultChecked"]; readonly disabled?: SwitchInput["disabled"]; readonly readOnly?: SwitchInput["readOnly"]; readonly name?: string; readonly value?: string; readonly required?: boolean; /** Accessible-name escape hatch [baseline #17] — see `SwitchLabel` for the primary path. */ readonly ariaLabel?: string; /** * Seeds the part scope INSTEAD of the generated id when supplied * [baseline #10]: `<SwitchRoot id="wifi">` yields deterministic * `hidden-input`/`label`/`description` ids derived from `"wifi"`. Feeds * `useSwitch`'s `id` option — see that primitive's doc comment. * Intercepted here rather than left in the native passthrough, so it * configures the scope seed instead of landing on the rendered `<label>` * as a plain HTML `id` attribute. */ readonly id?: string; readonly onCheckedChange?: (detail: SwitchChangeDetail) => void; readonly onChange?: (event: Event) => void; readonly children?: JSX.Element;}ariaLabelstringcheckedSwitchInput["checked"]childrenJSX.ElementdefaultCheckedSwitchInput["defaultChecked"]disabledSwitchInput["disabled"]idstringnamestringonChange(event: Event) => voidonCheckedChange(detail: SwitchChangeDetail) => voidreadOnlySwitchInput["readOnly"]requiredbooleanvaluestring- Name
ariaLabel- Kind
- property
- Type
string- Requirement
- optional
- Description
- Accessible-name escape hatch [baseline #17] — see `SwitchLabel` for the primary path.
- Name
checked- Kind
- property
- Type
SwitchInput["checked"]- Requirement
- optional
- Description
- —
- Name
children- Kind
- property
- Type
JSX.Element- Requirement
- optional
- Description
- —
- Name
defaultChecked- Kind
- property
- Type
SwitchInput["defaultChecked"]- Requirement
- optional
- Description
- —
- Name
disabled- Kind
- property
- Type
SwitchInput["disabled"]- Requirement
- optional
- Description
- —
- Name
id- Kind
- property
- Type
string- Requirement
- optional
- Description
- Seeds the part scope INSTEAD of the generated id when supplied [baseline #10]: `<SwitchRoot id="wifi">` yields deterministic `hidden-input`/`label`/`description` ids derived from `"wifi"`. Feeds `useSwitch`'s `id` option — see that primitive's doc comment. Intercepted here rather than left in the native passthrough, so it configures the scope seed instead of landing on the rendered `<label>` as a plain HTML `id` attribute.
- Name
name- Kind
- property
- Type
string- Requirement
- optional
- Description
- —
- Name
onChange- Kind
- property
- Type
(event: Event) => void- Requirement
- optional
- Description
- —
- Name
onCheckedChange- Kind
- property
- Type
(detail: SwitchChangeDetail) => void- Requirement
- optional
- Description
- —
- Name
readOnly- Kind
- property
- Type
SwitchInput["readOnly"]- Requirement
- optional
- Description
- —
- Name
required- Kind
- property
- Type
boolean- Requirement
- optional
- Description
- —
- Name
value- Kind
- property
- Type
string- Requirement
- optional
- Description
- —
SwitchRootProvider
functionexport declare function SwitchRootProvider(props: SwitchRootProviderProps): JSX.Element;propsSwitchRootProviderPropsreturnJSX.Element- Name
props- Kind
- parameter
- Type
SwitchRootProviderProps- Requirement
- required
- Name
return- Kind
- return value
- Type
JSX.Element- Requirement
- n/a
SwitchRootProviderProps
interfaceexport interface SwitchRootProviderProps extends Omit<JSX.LabelHTMLAttributes<HTMLLabelElement>, "onChange"> { /** An existing `useSwitch()` result (advanced composition) — already fully configured. */ readonly value: UseSwitchResult; readonly children?: JSX.Element;}childrenJSX.ElementvalueUseSwitchResult- Name
children- Kind
- property
- Type
JSX.Element- Requirement
- optional
- Description
- —
- Name
value- Kind
- property
- Type
UseSwitchResult- Requirement
- required
- Description
- An existing `useSwitch()` result (advanced composition) — already fully configured.
SwitchThumb
valueexport declare const SwitchThumb: (props: SwitchPartProps) => JSX.Element;propsSwitchPartPropsreturnJSX.Element- Name
props- Kind
- parameter
- Type
SwitchPartProps- Requirement
- required
- Name
return- Kind
- return value
- Type
JSX.Element- Requirement
- n/a
useSwitch
functionexport declare function useSwitch(input: Accessor<SwitchInput>, connectConfig: Accessor<SwitchConnectConfig>, options?: UseSwitchOptions): UseSwitchResult;inputAccessor<SwitchInput>connectConfigAccessor<SwitchConnectConfig>optionsUseSwitchOptionsreturnUseSwitchResult- Name
input- Kind
- parameter
- Type
Accessor<SwitchInput>- Requirement
- required
- Name
connectConfig- Kind
- parameter
- Type
Accessor<SwitchConnectConfig>- Requirement
- required
- Name
options- Kind
- parameter
- Type
UseSwitchOptions- Requirement
- optional
- Name
return- Kind
- return value
- Type
UseSwitchResult- Requirement
- n/a
useSwitchContext
functionexport declare function useSwitchContext(partName: string): SwitchContextValue;partNamestringreturnSwitchContextValue- Name
partName- Kind
- parameter
- Type
string- Requirement
- required
- Name
return- Kind
- return value
- Type
SwitchContextValue- Requirement
- n/a
UseSwitchOptions
interfaceexport interface UseSwitchOptions { readonly onCheckedChange?: (detail: SwitchChangeDetail) => void; readonly onChange?: (event: Event) => void; readonly id?: string;}idstringonChange(event: Event) => voidonCheckedChange(detail: SwitchChangeDetail) => void- Name
id- Kind
- property
- Type
string- Requirement
- optional
- Name
onChange- Kind
- property
- Type
(event: Event) => void- Requirement
- optional
- Name
onCheckedChange- Kind
- property
- Type
(detail: SwitchChangeDetail) => void- Requirement
- optional
UseSwitchResult
interfaceexport interface UseSwitchResult { readonly service: SwitchService; readonly connector: SwitchApi; readonly scope: PartScope; readonly snapshot: Accessor<SwitchSnapshot>; /** Compatibility accessor; registration invalidation is owned by the shared factory snapshot. */ readonly relationshipTick: Accessor<number>;}connectorSwitchApirelationshipTickAccessor<number>scopePartScopeserviceSwitchServicesnapshotAccessor<SwitchSnapshot>- Name
connector- Kind
- property
- Type
SwitchApi- Requirement
- required
- Description
- —
- Name
relationshipTick- Kind
- property
- Type
Accessor<number>- Requirement
- required
- Description
- Compatibility accessor; registration invalidation is owned by the shared factory snapshot.
- Name
scope- Kind
- property
- Type
PartScope- Requirement
- required
- Description
- —
- Name
service- Kind
- property
- Type
SwitchService- Requirement
- required
- Description
- —
- Name
snapshot- Kind
- property
- Type
Accessor<SwitchSnapshot>- Requirement
- required
- Description
- —