@kitn.ai/ui
Version:
Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. Authored in SolidJS.
27 lines (26 loc) • 1.17 kB
TypeScript
export interface SwitchProps {
/** Controlled checked state. When set, the component defers state to the
* parent; drive it from `onChange`. Omit for uncontrolled (internal) state. */
checked?: boolean;
/** Initial checked state when uncontrolled. */
defaultChecked?: boolean;
/** Disable interaction. */
disabled?: boolean;
/** Accessible label for the control. */
label?: string;
/** Form-control name. When set (paired with `value`), a hidden checkbox carries
* the on/off value for serialization. */
name?: string;
/** Submitted value when checked (paired with `name`). Defaults to `'on'`. */
value?: string;
/** Fires with the next checked state on toggle. */
onChange?: (checked: boolean) => void;
/** Receives the inner `role="switch"` button so a parent can focus it. */
buttonRef?: (el: HTMLButtonElement) => void;
class?: string;
}
/**
* A toggle switch (`role="switch"`). Controlled via `checked`, or uncontrolled
* from `defaultChecked`. Keyboard-operable (Space/Enter) and theme-tokened.
*/
export declare function Switch(props: SwitchProps): import("solid-js").JSX.Element;