UNPKG

@yamada-ui/segmented-control

Version:

Yamada UI segmented control components

88 lines (85 loc) 2.73 kB
import * as _yamada_ui_core from '@yamada-ui/core'; import { HTMLUIProps, ThemeProps } from '@yamada-ui/core'; import { MotionProps } from '@yamada-ui/motion'; import { ChangeEventHandler } from 'react'; interface SegmentedControlItem extends SegmentedControlButtonProps { label?: string; } interface SegmentedControlOptions { /** * The HTML `name` attribute used for forms. */ name?: string; /** * The initial value of the segmented control. */ defaultValue?: string; /** * If `true`, the segmented control will be disabled. * * @default false */ disabled?: boolean; /** * If `true`, the segmented control will be disabled. * * @default false * * @deprecated Use `disabled` instead. */ isDisabled?: boolean; /** * If `true`, the segmented control will be readonly. * * @default false * * @deprecated Use `readOnly` instead. */ isReadOnly?: boolean; /** * If provided, generate segmented control buttons but based on items. * * @default '[]' */ items?: SegmentedControlItem[]; /** * If `true`, the segmented control will be readonly. * * @default false */ readOnly?: boolean; /** * The value of the segmented control. */ value?: string; /** * The callback fired when any children radio is checked or unchecked. */ onChange?: (value: string) => void; } interface SegmentedControlProps extends Omit<HTMLUIProps, "defaultValue" | "onChange" | "value">, ThemeProps<"SegmentedControl">, SegmentedControlOptions { } /** * `SegmentedControl` is a component used for allowing users to select one option from multiple choices. * * @see Docs https://yamada-ui.com/components/forms/segmented-control */ declare const SegmentedControl: _yamada_ui_core.Component<"div", SegmentedControlProps>; interface SegmentedControlButtonOptions { /** * The value of the segmented control button. */ value: string; /** * Props for motion component. */ motionProps?: MotionProps; /** * The callback fired when any children radio is checked or unchecked. */ onChange?: ChangeEventHandler<HTMLInputElement>; } interface SegmentedControlButtonProps extends Omit<HTMLUIProps<"label">, "onChange">, Pick<SegmentedControlProps, "disabled" | "isDisabled" | "isReadOnly" | "readOnly">, SegmentedControlButtonOptions { } declare const SegmentedControlButton: _yamada_ui_core.Component<"input", SegmentedControlButtonProps>; export { SegmentedControl, SegmentedControlButton, type SegmentedControlButtonProps, type SegmentedControlItem, type SegmentedControlProps };