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.

31 lines (30 loc) 1.14 kB
import * as React from 'react'; import type { BaseUIComponentProps } from '../utils/types.js'; import { useToggle } from './useToggle.js'; /** * A two-state button that can be on or off. * Renders a `<button>` element. * * Documentation: [Base UI Toggle](https://base-ui.com/react/components/toggle) */ declare const Toggle: React.ForwardRefExoticComponent<Toggle.Props & React.RefAttributes<HTMLButtonElement>>; export { Toggle }; export declare namespace Toggle { interface State { pressed: boolean; /** * Whether the component should ignore user interaction. */ disabled: boolean; } interface Props extends Partial<Pick<useToggle.Parameters, 'pressed' | 'defaultPressed' | 'disabled' | 'onPressedChange' | 'value'>>, Omit<BaseUIComponentProps<'button', State>, 'value'> { /** * The label for the Toggle. */ 'aria-label'?: React.AriaAttributes['aria-label']; /** * An id or space-separated list of ids of elements that label the Toggle. */ 'aria-labelledby'?: React.AriaAttributes['aria-labelledby']; } }