@payfit/unity-components
Version:
64 lines (63 loc) • 2.15 kB
TypeScript
import { ReactNode } from 'react';
import { CheckboxFieldProps as AriaCheckboxFieldProps } from 'react-aria-components/Checkbox';
export interface CheckboxStandaloneProps extends AriaCheckboxFieldProps {
/**
* The content to display as the checkbox label.
* This is required for accessibility.
*/
children: ReactNode;
/**
* Whether the checkbox is disabled.
* When true, the checkbox cannot be interacted with and appears dimmed.
* @default false
*/
isDisabled?: boolean;
/**
* Whether the checkbox is in a read-only state.
* When true, the checkbox cannot be modified but maintains normal appearance and can be focused.
* @default false
*/
isReadOnly?: boolean;
/**
* Whether the checkbox is in an invalid state.
* Use this for form validation feedback.
* @default false
*/
isInvalid?: boolean;
/**
* Whether the checkbox is selected (controlled).
* Use this with `onChange` for controlled checkbox state.
*/
isSelected?: boolean;
/**
* The default selected state (uncontrolled).
* Use this when you don't need to control the checkbox state.
* @default false
*/
defaultSelected?: boolean;
/**
* Whether the checkbox is in an indeterminate state.
* Useful for parent checkboxes in a tree structure.
* @default false
*/
isIndeterminate?: boolean;
/**
* Handler called when the checkbox's selected state changes.
* @param isSelected The new selected state
*/
onChange?: (isSelected: boolean) => void;
/**
* Handler called when the checkbox receives focus.
*/
onFocus?: () => void;
/**
* Handler called when the checkbox loses focus.
*/
onBlur?: () => void;
}
/**
* This is an inner version of the checkbox that does not have any label.
* Used for internal purposes as part of other components, like table row selection.
*/
declare const CheckboxStandalone: import('react').ForwardRefExoticComponent<CheckboxStandaloneProps & import('react').RefAttributes<HTMLLabelElement>>;
export { CheckboxStandalone };