UNPKG

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