@cbinsights/fds
Version:
Form: A design system by CB Insights
23 lines (22 loc) • 1.11 kB
TypeScript
import { HTMLAttributes } from 'react';
import * as CheckboxUi from '@radix-ui/react-checkbox';
declare type CheckboxExtended = Omit<HTMLAttributes<HTMLInputElement>, 'onChange' | 'ref'>;
export interface CheckboxProps extends CheckboxExtended {
/** Label used for a11y attributes _and_ the rendered `label` element */
label: string;
/** If the supplied `label` prop should be rendered to the screen. */
showLabel?: boolean;
/** Sets type `indeterminate` to `true` */
indeterminate?: boolean;
/** Disables form field when `true` */
disabled?: boolean;
/** Supplies an `id` to the input, it is often used with `showLabel={false}` to connect the label. */
id?: string;
name?: string;
/*** callback that passes back the checkbox state - true, false or "indeterminate" */
onChange?: (checkedEvent: CheckboxUi.CheckedState) => void;
/*** Value of checkbox */
checked?: boolean;
}
declare const Checkbox: ({ showLabel, indeterminate, disabled, label, defaultChecked, checked, id, onChange, ...rest }: CheckboxProps) => JSX.Element;
export default Checkbox;