UNPKG

@yamada-ui/react

Version:

React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion

56 lines (55 loc) 1.76 kB
import { HTMLProps, HTMLRefAttributes, PropGetter } from "../../core/components/index.types.js"; import "../../core/index.js"; import { FieldProps } from "../field/field.js"; import { ChangeEvent, ChangeEventHandler, FocusEventHandler } from "react"; //#region src/components/radio/use-radio.d.ts interface UseRadioProps<Y extends string = string> extends Omit<HTMLProps<"label">, "onBlur" | "onChange" | "onFocus" | "ref">, HTMLRefAttributes<"input">, FieldProps { /** * id assigned to input. */ id?: string; /** * The name of the input field in a radio. */ name?: string; /** * If `true`, the radio will be checked. */ checked?: boolean; /** * If `true`, the radio will be initially checked. * * @default false */ defaultChecked?: boolean; /** * The value of the radio. */ value?: Y; /** * The callback invoked when the radio is blurred. */ onBlur?: FocusEventHandler<HTMLInputElement>; /** * The callback invoked when the checked state changes. */ onChange?: ChangeEventHandler<HTMLInputElement>; /** * The callback invoked when the radio is focused. */ onFocus?: FocusEventHandler<HTMLInputElement>; } declare const useRadio: <Y extends string = string>({ "aria-describedby": ariaDescribedbyProp, ...props }?: UseRadioProps<Y>) => { checked: boolean; getIndicatorProps: PropGetter<"div", undefined, undefined>; getInputProps: PropGetter<"input", undefined, undefined>; getRootProps: PropGetter<"label", undefined, undefined>; onChange: (ev: ChangeEvent<HTMLInputElement>) => true | undefined; }; type UseRadioReturn = ReturnType<typeof useRadio>; //#endregion export { UseRadioProps, UseRadioReturn, useRadio }; //# sourceMappingURL=use-radio.d.ts.map