UNPKG

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