@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
20 lines (19 loc) • 602 B
TypeScript
export interface UseControlledProps<T = unknown> {
/**
* Holds the component value when it's controlled.
*/
controlled: T | undefined;
/**
* The default value when uncontrolled.
*/
default: T | undefined;
/**
* The component name displayed in warnings.
*/
name: string;
/**
* The name of the state variable displayed in warnings.
*/
state?: string;
}
export declare function useControlled<T = unknown>({ controlled, default: defaultProp, name, state, }: UseControlledProps<T>): [T, (newValue: T | ((prevValue: T) => T)) => void];