@react-md/form
Version:
This package is for creating all the different form input types.
17 lines (16 loc) • 828 B
TypeScript
import type { Dispatch, SetStateAction } from "react";
declare type ChangeEventHandler = React.ChangeEventHandler<HTMLInputElement>;
declare type SetChecked = Dispatch<SetStateAction<boolean>>;
/**
* A small hook that can be used for controlling the state of a single Checkbox
* component.
*
* @param defaultChecked - Boolean if the input should be checked by default.
* Changing this value will not update the state after initial render.
* @param onChange - An optional change event handler to also call when the
* checked state changes.
* @returns a list containing the checked state, a change event handler, and
* then a manual set checked action.
*/
export declare function useChecked(defaultChecked: boolean | (() => boolean), onChange?: ChangeEventHandler): [boolean, ChangeEventHandler, SetChecked];
export {};