UNPKG

@yamada-ui/react

Version:

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

45 lines (44 loc) 1.47 kB
import { Merge } from "../../utils/index.js"; import { HTMLProps, HTMLRefAttributes, PropGetter } from "../../core/components/index.types.js"; import "../../core/index.js"; import { FieldProps } from "../field/field.js"; import * as react2612 from "react"; //#region src/components/toggle/use-toggle.d.ts interface UseToggleProps<Y extends string = string> extends FieldProps, HTMLRefAttributes<"input">, Omit<HTMLProps<"button">, "onChange" | "ref" | "value"> { /** * If `true`, the toggle button is represented as active. * * @default false */ active?: boolean; /** * If `true`, the toggle button will be checked. */ checked?: boolean; /** * If `true`, the toggle button will be initially checked. * * @default false */ defaultChecked?: boolean; /** * The value of the toggle button. */ value?: Y; /** * The callback invoked when checked state changes. */ onChange?: (checked: boolean) => void; } declare const useToggle: <Y extends string = string>(props?: UseToggleProps<Y>) => { checked: boolean; setChecked: react2612.Dispatch<react2612.SetStateAction<boolean>>; getButtonProps: PropGetter<"button", undefined, Merge<HTMLProps<"button">, { "aria-label": string; }>>; getInputProps: PropGetter<"input", undefined, undefined>; }; type UseToggleReturn = ReturnType<typeof useToggle>; //#endregion export { UseToggleProps, UseToggleReturn, useToggle }; //# sourceMappingURL=use-toggle.d.ts.map