UNPKG

1.45 kBTypeScriptView Raw
1import * as React from "react";
2import * as StyledSystem from "styled-system";
3import { BoxProps } from "../Box";
4import { ICheckbox } from "../Checkbox";
5import { Omit } from "../common-types";
6
7export interface ICheckboxGroup {
8 /**
9 * The id of the checkbox group.
10 */
11 id?: ICheckbox["id"];
12 /**
13 * The name of the checkbox group. This prop is passed to each checbox
14 */
15 name?: ICheckbox["name"];
16 /**
17 * The content of the checkbox group. Must be the `Checkbox` component
18 */
19 children?: React.ReactNode;
20 /**
21 * The initial value of the checkbox group
22 */
23 defaultValue?: Array<ICheckbox["value"]>;
24 /**
25 * The value of the checkbox group
26 */
27 value?: Array<ICheckbox["value"]>;
28 /**
29 * The callback fired when any children Checkbox is checked or unchecked
30 */
31 onChange?: (value: Array<ICheckbox["value"]>) => void;
32 /**
33 * The space between each checkbox
34 */
35 spacing?: StyledSystem.MarginProps["margin"];
36 /**
37 * If `true`, the checkboxes will aligned horizontally.
38 */
39 isInline?: boolean;
40 /**
41 * The color of the checkbox when it's checked.
42 */
43 variantColor?: ICheckbox["variantColor"];
44 /**
45 * The size of the checkbox. It's forwarded to all children checkbox
46 */
47 size?: ICheckbox["size"];
48}
49
50export type CheckboxGroupProps = ICheckboxGroup &
51 Omit<BoxProps, "onChange" | "size">;
52declare const CheckboxGroup: React.FC<CheckboxGroupProps>;
53export default CheckboxGroup;