UNPKG

1.91 kBTypeScriptView Raw
1import * as React from "react";
2import { AbstractPureComponent, OptionProps, Props } from "../../common";
3export interface RadioGroupProps extends Props {
4 /**
5 * Radio elements. This prop is mutually exclusive with `options`.
6 */
7 children?: React.ReactNode;
8 /**
9 * Whether the group and _all_ its radios are disabled.
10 * Individual radios can be disabled using their `disabled` prop.
11 */
12 disabled?: boolean;
13 /**
14 * Whether the radio buttons are to be displayed inline horizontally.
15 */
16 inline?: boolean;
17 /** Optional label text to display above the radio buttons. */
18 label?: React.ReactNode;
19 /**
20 * Name of the group, used to link radio buttons together in HTML.
21 * If omitted, a unique name will be generated internally.
22 */
23 name?: string;
24 /**
25 * Callback invoked when the currently selected radio changes.
26 * Use `event.currentTarget.value` to read the currently selected value.
27 * This prop is required because this component only supports controlled usage.
28 */
29 onChange: (event: React.FormEvent<HTMLInputElement>) => void;
30 /**
31 * Array of options to render in the group. This prop is mutually exclusive
32 * with `children`: either provide an array of `OptionProps` objects or
33 * provide `<Radio>` children elements.
34 */
35 options?: readonly OptionProps[];
36 /** Value of the selected radio. The child with this value will be `:checked`. */
37 selectedValue?: string | number;
38}
39/**
40 * Radio group component.
41 *
42 * @see https://blueprintjs.com/docs/#core/components/radio.radiogroup
43 */
44export declare class RadioGroup extends AbstractPureComponent<RadioGroupProps> {
45 static displayName: string;
46 private autoGroupName;
47 render(): JSX.Element;
48 protected validateProps(): void;
49 private renderChildren;
50 private renderOptions;
51 private getRadioProps;
52}