UNPKG

@baseplate-dev/ui-components

Version:

Shared UI component library

19 lines 1.26 kB
import type { ComponentPropsWithRef } from 'react'; import type React from 'react'; import type { Control, FieldPath, FieldValues } from 'react-hook-form'; import type { FormFieldProps } from '#src/types/form.js'; interface CheckboxFieldProps extends Omit<ComponentPropsWithRef<'button'>, 'onCheckedChange' | 'checked' | 'onChange' | 'value'>, FormFieldProps { onChange?: (value: boolean) => void; value?: boolean; } /** * Field with label and error states that wraps a Checkbox component. */ declare function CheckboxField({ label, description, error, onChange, value, className, ...props }: CheckboxFieldProps): React.ReactElement; interface CheckboxFieldControllerProps<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<CheckboxFieldProps, 'value'> { control: Control<TFieldValues>; name: TFieldName; } declare function CheckboxFieldController<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, name, ...rest }: CheckboxFieldControllerProps<TFieldValues, TFieldName>): React.ReactElement; export { CheckboxField, CheckboxFieldController }; //# sourceMappingURL=checkbox-field.d.ts.map