UNPKG

1.23 kBTypeScriptView Raw
1import * as React from "react";
2import { ButtonGroup } from "react-bootstrap";
3import { Omit } from "../index";
4
5declare namespace ToggleButtonGroup {
6 interface BaseProps {
7 /**
8 * You'll usually want to use string|number|string[]|number[] here,
9 * but you can technically use any|any[].
10 */
11 defaultValue?: any;
12 /**
13 * You'll usually want to use string|number|string[]|number[] here,
14 * but you can technically use any|any[].
15 */
16 value?: any;
17 }
18
19 interface RadioProps {
20 /** Required if `type` is set to "radio" */
21 name: string;
22 type: "radio";
23 onChange?(value: any): void;
24 }
25
26 interface CheckboxProps {
27 name?: string | undefined;
28 type: "checkbox";
29 onChange?(values: any[]): void;
30 }
31
32 export type ToggleButtonGroupProps =
33 & BaseProps
34 & (RadioProps | CheckboxProps)
35 & Omit<ButtonGroup.ButtonGroupProps, "onChange">
36 & Omit<React.HTMLProps<ToggleButtonGroup>, "defaultValue" | "type" | "value" | "onChange">;
37}
38declare class ToggleButtonGroup extends React.Component<ToggleButtonGroup.ToggleButtonGroupProps> {}
39export = ToggleButtonGroup;