UNPKG

@base-ui-components/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

35 lines (34 loc) 1.24 kB
import * as React from 'react'; import { useSwitchRoot } from './useSwitchRoot.js'; import type { FieldRoot } from '../../field/root/FieldRoot.js'; import type { BaseUIComponentProps } from '../../utils/types.js'; /** * Represents the switch itself. * Renders a `<button>` element and a hidden `<input>` beside. * * Documentation: [Base UI Switch](https://base-ui.com/react/components/switch) */ declare const SwitchRoot: React.ForwardRefExoticComponent<SwitchRoot.Props & React.RefAttributes<HTMLButtonElement>>; declare namespace SwitchRoot { interface Props extends useSwitchRoot.Parameters, Omit<BaseUIComponentProps<'button', SwitchRoot.State>, 'onChange'> { } interface State extends FieldRoot.State { /** * Whether the switch is currently active. */ checked: boolean; /** * Whether the component should ignore user interaction. */ disabled: boolean; /** * Whether the user should be unable to activate or deactivate the switch. */ readOnly: boolean; /** * Whether the user must activate the switch before submitting a form. */ required: boolean; } } export { SwitchRoot };