UNPKG

1.3 kBTypeScriptView Raw
1import * as React from 'react';
2import { StandardProps } from '..';
3import { FormGroupProps, FormGroupClassKey } from '../FormGroup';
4
5export interface RadioGroupProps
6 extends StandardProps<FormGroupProps, RadioGroupClassKey, 'onChange'> {
7 /**
8 * The default `input` element value. Use when the component is not controlled.
9 */
10 defaultValue?: FormGroupProps['defaultValue'];
11 /**
12 * The name used to reference the value of the control.
13 * If you don't provide this prop, it falls back to a randomly generated name.
14 */
15 name?: string;
16 /**
17 * Callback fired when a radio button is selected.
18 *
19 * @param {object} event The event source of the callback.
20 * You can pull out the new value by accessing `event.target.value` (string).
21 */
22 onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void;
23 /**
24 * Value of the selected radio button. The DOM API casts this to a string.
25 */
26 value?: any;
27}
28
29export type RadioGroupClassKey = FormGroupClassKey;
30
31/**
32 *
33 * Demos:
34 *
35 * - [Radio Buttons](https://mui.com/components/radio-buttons/)
36 *
37 * API:
38 *
39 * - [RadioGroup API](https://mui.com/api/radio-group/)
40 * - inherits [FormGroup API](https://mui.com/api/form-group/)
41 */
42export default function RadioGroup(props: RadioGroupProps): JSX.Element;