UNPKG

@accelint/design-toolkit

Version:

An open-source component library to serve as part of the entire ecosystem of UX for Accelint.

55 lines (52 loc) 1.55 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import * as react from 'react'; import { ContextValue } from 'react-aria-components'; import { ProviderProps } from '../../lib/types.js'; import { SwitchProps } from './types.js'; declare const SwitchContext: react.Context<ContextValue<SwitchProps, HTMLLabelElement>>; declare function SwitchProvider({ children, ...props }: ProviderProps<SwitchProps>): react_jsx_runtime.JSX.Element; declare namespace SwitchProvider { var displayName: string; } /** * Switch - A toggle control for binary state changes * * Provides an accessible toggle switch component for enabling/disabling features * or settings. Offers clear visual feedback for on/off states with smooth transitions * and proper keyboard and screen reader support. * * @example * // Basic switch * <Switch>Enable notifications</Switch> * * @example * // Controlled switch * <Switch * isSelected={isEnabled} * onChange={setIsEnabled} * > * Dark mode * </Switch> * * @example * // Switch with default state * <Switch defaultSelected> * Auto-save documents * </Switch> * * @example * // Disabled switch * <Switch isDisabled> * Premium feature (upgrade required) * </Switch> * * @example * // Switch without label (icon-only) * <Switch aria-label="Toggle sidebar" /> */ declare function Switch({ ref, ...props }: SwitchProps): react_jsx_runtime.JSX.Element; declare namespace Switch { var displayName: string; var Provider: typeof SwitchProvider; } export { Switch, SwitchContext };