@leafygreen-ui/hooks
Version:
LeafyGreen UI Kit Custom Hooks
10 lines • 613 B
TypeScript
import { ChangeEventHandler } from 'react';
import { ControlledValueReturnObject } from './useControlledValue.types';
/**
* A hook that enables an input component to be both controlled or uncontrolled.
*
* Returns a {@link ControlledValueReturnObject} with the controlled or uncontrolled `value`,
* `onChange` & `onClear` handlers, a `setInternalValue` setter, and a boolean `isControlled`
*/
export declare const useControlledValue: <T>(controlledValue?: T, changeHandler?: ChangeEventHandler<any> | null, initialValue?: T) => ControlledValueReturnObject<T>;
//# sourceMappingURL=useControlledValue.d.ts.map