UNPKG

@metamask/design-system-react-native

Version:
1 lines 1.84 kB
{"version":3,"file":"Checkbox.types.cjs","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { PressableProps, ViewProps } from 'react-native';\n\nimport type { IconProps } from '../Icon';\nimport type { TextProps } from '../Text';\n/**\n * Checkbox component props.\n */\n\nexport type CheckboxProps = {\n /**\n * Required prop to determine whether the checkbox is currently selected.\n * This component is fully controlled, so you must manage this state\n * in your parent component.\n */\n isSelected: boolean;\n\n /**\n * Optional prop that when true, disables the checkbox.\n *\n * @default false\n */\n isDisabled?: boolean;\n\n /**\n * Optional prop that when true, displays the invalid/error state of the checkbox.\n *\n * @default false\n */\n isInvalid?: boolean;\n\n /**\n * Optional label prop that renders text or a React node as a label beside the checkbox.\n */\n label?: React.ReactNode | string;\n\n /**\n * Optional props to be passed to the label's Text component.\n */\n labelProps?: Omit<Partial<TextProps>, 'children'>;\n\n /**\n * Required callback for when the checked state changes.\n * Use this to update your state.\n */\n onChange: (isSelected: boolean) => void;\n\n /**\n * Optional props passed to the container view wrapping the checkbox icon.\n */\n checkboxContainerProps?: Omit<Partial<ViewProps>, 'children'>;\n\n /**\n * Optional props to be passed to the check Icon component.\n */\n checkedIconProps?: Partial<IconProps>;\n\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n\n /**\n * Optional prop to control the style.\n */\n style?: PressableProps['style'];\n} & Omit<PressableProps, 'children'>;\n"]}