UNPKG

@yamada-ui/checkbox

Version:

Yamada UI checkbox component

73 lines (70 loc) 2.08 kB
import { HTMLUIProps, ThemeProps, ComponentArgs, FC } from '@yamada-ui/core'; import { FormControlOptions } from '@yamada-ui/form-control'; import { MotionProps } from '@yamada-ui/motion'; import { Merge } from '@yamada-ui/utils'; import { ReactNode, ReactElement, InputHTMLAttributes, Ref } from 'react'; import { UseCheckboxProps } from './use-checkbox.mjs'; interface CheckboxOptions { /** * The label of the checkbox. */ label?: ReactNode; /** * Props for icon component. */ iconProps?: { children: ReactElement; } & Omit<HTMLUIProps, "children">; /** * Props for input element. */ inputProps?: InputHTMLAttributes<HTMLInputElement>; /** * Props for label element. */ labelProps?: HTMLUIProps<"span">; } interface CheckboxProps<Y extends number | string = string> extends Merge<HTMLUIProps<"label">, UseCheckboxProps<Y>>, ThemeProps<"Checkbox">, CheckboxOptions { } /** * `Checkbox` is a component used for allowing users to select multiple values from multiple options. * * @see Docs https://yamada-ui.com/components/forms/checkbox */ declare const Checkbox: { <Y extends number | string = string>(props: { ref?: Ref<HTMLInputElement>; } & CheckboxProps<Y>): ReactElement; } & ComponentArgs; type CheckboxIconProps = { /** * If `true`, the icon will be checked. * * @default false */ checked?: boolean; /** * If `true`, the icon will be indeterminate. * * @default false */ indeterminate?: boolean; /** * If `true`, the icon will be checked. * * @default false * * @deprecated Use `checked` instead. */ isChecked?: boolean; /** * If `true`, the icon will be indeterminate. * * @default false * * @deprecated Use `indeterminate` instead. */ isIndeterminate?: boolean; } & FormControlOptions & MotionProps<"svg">; declare const CheckboxIcon: FC<CheckboxIconProps>; export { Checkbox, CheckboxIcon, type CheckboxIconProps, type CheckboxProps };