@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
33 lines (32 loc) • 1.02 kB
TypeScript
import * as React from "react";
import { CompositeActions, CompositeInitialState, CompositeState } from "reakit";
export declare type RadioState = CompositeState & {
/**
* The `value` attribute of the current active radio.
*/
state: string | number | null;
};
export declare type RadioActions = CompositeActions & {
/**
* Sets `state`.
*/
setState: React.Dispatch<React.SetStateAction<string | number | null>>;
};
export declare type RadioInitialState = CompositeInitialState & {
/**
* Default State of the Radio for uncontrolled Radio.
*
* @default false
*/
defaultState?: RadioState["state"];
/**
* State of the Radio for controlled Radio..
*/
state?: RadioState["state"];
/**
* OnChange callback for controlled Radio.
*/
onStateChange?: RadioActions["setState"];
};
export declare type RadioStateReturn = RadioState & RadioActions;
export declare function useRadioState(props: RadioInitialState): RadioStateReturn;