UNPKG

@renderlesskit/react

Version:

Collection of headless components/hooks that are accessible, composable, customizable from low level to build your own UI & Design System powered by Reakit

34 lines (33 loc) 1.09 kB
/// <reference types="react" /> export declare type CheckboxState = { /** * Stores the state of the checkbox. * If checkboxes that share this state have defined a `value` prop, it's * going to be an array. */ state: boolean | "indeterminate" | Array<number | string>; }; export declare type CheckboxActions = { /** * Sets `state` for the checkbox. */ setState: React.Dispatch<React.SetStateAction<CheckboxState["state"]>>; }; export declare type CheckboxInitialState = { /** * Default State of the Checkbox for uncontrolled Checkbox. * * @default false */ defaultState?: CheckboxState["state"]; /** * State of the Checkbox for controlled Checkbox.. */ state?: CheckboxState["state"]; /** * OnChange callback for controlled Checkbox. */ onStateChange?: React.Dispatch<React.SetStateAction<CheckboxState["state"]>>; }; export declare type CheckboxStateReturn = CheckboxState & CheckboxActions; export declare function useCheckboxState(props?: CheckboxInitialState): CheckboxStateReturn;