1 | import { BoxProps } from "../Box";
|
2 | import * as React from "react";
|
3 | import { Omit } from "../common-types";
|
4 |
|
5 | export interface ISwitch {
|
6 | /**
|
7 | * The size of the switch
|
8 | */
|
9 | size?: "sm" | "md" | "lg";
|
10 | /**
|
11 | * The background color of the switch when checked
|
12 | *
|
13 | * 🚨Note: This should be one of the color keys in the theme that has `100` - `900` color values (e.g.`green`, `red`).
|
14 | * @see http://chakra-ui.com/theme#colors
|
15 | */
|
16 | color?: string;
|
17 | /**
|
18 | * The input name of the switch when used in a form
|
19 | */
|
20 | name?: string;
|
21 | /**
|
22 | * The value of the switch.
|
23 | */
|
24 | value?: string | number | boolean;
|
25 | /**
|
26 | * The children of the switch.
|
27 | */
|
28 | children?: React.ReactNode;
|
29 | /**
|
30 | * The aria-label of the switch for accessibility.
|
31 | */
|
32 | "aria-label"?: string;
|
33 | /**
|
34 | * The aria-labelledby of the switch for accessibility.
|
35 | */
|
36 | "aria-labelledby"?: string;
|
37 | /**
|
38 | * If `true`, set the switch to the checked state.
|
39 | */
|
40 | isChecked?: boolean;
|
41 | /**
|
42 | * If `true`, the switch will be initially checked.
|
43 | */
|
44 | defaultIsChecked?: boolean;
|
45 | /**
|
46 | * If `true`, set the disabled to the invalid state.
|
47 | */
|
48 | isDisabled?: boolean;
|
49 | /**
|
50 | * If `true`, set the switch to the invalid state.
|
51 | */
|
52 | isInvalid?: boolean;
|
53 | }
|
54 |
|
55 | export type SwitchProps = ISwitch & Omit<BoxProps, "defaultChecked" | "size">;
|
56 |
|
57 | declare const Switch: React.FC<SwitchProps>;
|
58 |
|
59 | export default Switch;
|