@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
41 lines (40 loc) • 1.68 kB
TypeScript
import { HTMLProps, PropGetter } from "../../core/components/index.types.js";
import "../../core/index.js";
import { FieldProps } from "../field/field.js";
import * as react920 from "react";
import { ChangeEvent } from "react";
//#region src/components/checkbox/use-checkbox-group.d.ts
interface CheckboxGroupContext extends Omit<UseCheckboxGroupReturn, "getRootProps"> {}
declare const CheckboxGroupContext: react920.Context<CheckboxGroupContext | undefined>, useCheckboxGroupContext: () => CheckboxGroupContext | undefined;
interface UseCheckboxGroupProps<Y extends string = string> extends Omit<HTMLProps, "defaultValue" | "onChange" | "value">, FieldProps {
/**
* The initial value of the checkbox group.
*
* @default []
*/
defaultValue?: Y[];
/**
* The maximum number of checkboxes that can be checked.
*/
max?: number;
/**
* The value of the checkbox group.
*/
value?: Y[];
/**
* The callback fired when any children checkbox is checked or unchecked.
*/
onChange?: (value: Y[]) => void;
}
declare const useCheckboxGroup: <Y extends string = string>(props?: UseCheckboxGroupProps<Y>) => {
max: number | undefined;
value: Y[];
getInputProps: PropGetter<"input", undefined, undefined>;
getLabelProps: PropGetter<"label", undefined, undefined>;
getRootProps: PropGetter<"div", undefined, undefined>;
onChange: (valueOrEv: ChangeEvent<HTMLInputElement> | Y) => void;
};
type UseCheckboxGroupReturn = ReturnType<typeof useCheckboxGroup>;
//#endregion
export { CheckboxGroupContext, UseCheckboxGroupProps, UseCheckboxGroupReturn, useCheckboxGroup, useCheckboxGroupContext };
//# sourceMappingURL=use-checkbox-group.d.ts.map