@nopends-ui/checkbox-group
Version:
Checkbox Group is a component that allows users to select multiple options from a list of options.
97 lines (88 loc) • 4.92 kB
TypeScript
import { Primitive, Direction } from '@nopends-ui/shared';
import * as React from 'react';
interface CheckboxGroupRootProps extends Omit<React.ComponentPropsWithoutRef<typeof Primitive.div>, "value" | "defaultValue" | "onChange" | "onInvalid"> {
/** Controlled value. */
value?: string[];
/** Initial value when uncontrolled. */
defaultValue?: string[];
/** Callback when value changes. */
onValueChange?: (value: string[]) => void;
/** Callback when value is validated. */
onValidate?: (value: string[]) => string | string[] | true | null | undefined;
/** Whether the checkbox group is disabled. */
disabled?: boolean;
/** Whether the checkbox group is invalid. */
invalid?: boolean;
/**
* Whether the checkbox group is read-only.
* @default false
*/
readOnly?: boolean;
/**
* Whether the checkbox group is required in a form context.
* @default false
*/
required?: boolean;
/** The name of the checkbox group for form submission. */
name?: string;
/**
* The reading direction of the checkbox group.
* @default "ltr"
*/
dir?: Direction;
/**
* The orientation of the checkbox group.
* @default "vertical"
*/
orientation?: "horizontal" | "vertical";
}
declare const CheckboxGroupRoot: React.ForwardRefExoticComponent<CheckboxGroupRootProps & React.RefAttributes<HTMLDivElement>>;
declare const Root: React.ForwardRefExoticComponent<CheckboxGroupRootProps & React.RefAttributes<HTMLDivElement>>;
interface CheckboxGroupLabelProps extends React.ComponentPropsWithoutRef<typeof Primitive.label> {
}
declare const CheckboxGroupLabel: React.ForwardRefExoticComponent<CheckboxGroupLabelProps & React.RefAttributes<HTMLLabelElement>>;
declare const Label: React.ForwardRefExoticComponent<CheckboxGroupLabelProps & React.RefAttributes<HTMLLabelElement>>;
interface CheckboxGroupListProps extends React.ComponentPropsWithoutRef<typeof Primitive.div> {
}
declare const CheckboxGroupList: React.ForwardRefExoticComponent<CheckboxGroupListProps & React.RefAttributes<HTMLDivElement>>;
declare const List: React.ForwardRefExoticComponent<CheckboxGroupListProps & React.RefAttributes<HTMLDivElement>>;
interface CheckboxGroupItemProps extends Omit<React.ComponentPropsWithoutRef<typeof Primitive.button>, "checked" | "defaultChecked" | "onCheckedChange"> {
/** Value of the checkbox. */
value: string;
/** Whether the checkbox is disabled. */
disabled?: boolean;
/** Whether the checkbox is required. */
required?: boolean;
}
declare const CheckboxGroupItem: React.ForwardRefExoticComponent<CheckboxGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
declare const Item: React.ForwardRefExoticComponent<CheckboxGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
interface CheckboxGroupIndicatorProps extends React.ComponentPropsWithoutRef<typeof Primitive.span> {
/** Whether the indicator should always be rendered. */
forceMount?: boolean;
}
declare const CheckboxGroupIndicator: React.ForwardRefExoticComponent<CheckboxGroupIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
declare const Indicator: React.ForwardRefExoticComponent<CheckboxGroupIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
interface CheckboxGroupDescriptionProps extends React.ComponentPropsWithoutRef<typeof Primitive.div> {
/**
* Whether the description should be announced by screen readers immediately upon rendering.
* @default false
*/
announce?: boolean;
/**
* Hide the description when the checkbox group is in an error state.
* @default false
*/
hideOnError?: boolean;
}
declare const CheckboxGroupDescription: React.ForwardRefExoticComponent<CheckboxGroupDescriptionProps & React.RefAttributes<HTMLDivElement>>;
declare const Description: React.ForwardRefExoticComponent<CheckboxGroupDescriptionProps & React.RefAttributes<HTMLDivElement>>;
interface CheckboxGroupMessageProps extends React.ComponentPropsWithoutRef<typeof Primitive.div> {
/**
* Whether the description should be announced by screen readers immediately upon rendering.
* @default false
*/
announce?: boolean;
}
declare const CheckboxGroupMessage: React.ForwardRefExoticComponent<CheckboxGroupMessageProps & React.RefAttributes<HTMLDivElement>>;
declare const Message: React.ForwardRefExoticComponent<CheckboxGroupMessageProps & React.RefAttributes<HTMLDivElement>>;
export { CheckboxGroupDescription, type CheckboxGroupDescriptionProps, CheckboxGroupIndicator, type CheckboxGroupIndicatorProps, CheckboxGroupItem, type CheckboxGroupItemProps, CheckboxGroupLabel, type CheckboxGroupLabelProps, CheckboxGroupList, type CheckboxGroupListProps, CheckboxGroupMessage, type CheckboxGroupMessageProps, CheckboxGroupRoot, type CheckboxGroupRootProps, Description, Indicator, Item, Label, List, Message, Root };