UNPKG

@clayui/form

Version:
48 lines (47 loc) 1.75 kB
/** * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com> * SPDX-License-Identifier: BSD-3-Clause */ import { InternalDispatch } from '@clayui/shared'; import React from 'react'; import Radio from './Radio'; import Toggle from './Toggle'; interface IGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> { /** * Takes either Radio or Toggle as a child. */ children: Array<React.ReactElement<React.ComponentProps<typeof Radio>> | React.ReactElement<React.ComponentProps<typeof Toggle>>>; /** * Property to set the default value (uncontrolled). */ defaultValue?: React.ReactText; /** * Flag to indicate if radio elements should display inline. */ inline?: boolean; /** * Form element `name` that is applied to each radio element. */ name?: string; /** * Callback function for whenever a radio element is selected (controlled). */ onChange?: InternalDispatch<React.ReactText>; /** * Callback function for whenever a radio element is selected. * @deprecated since v3.51.0 - use `onChange` instead. */ onSelectedValueChange?: InternalDispatch<React.ReactText>; /** * The value that corresponds to the selected radio element. Leave * undefined if no option is selected. * @deprecated since v3.51.0 - use `value` instead. */ selectedValue?: React.ReactText; /** * The value property sets the current value (controlled). */ value?: React.ReactText; } declare const RadioGroup: ({ children, className, defaultValue, inline, name, onChange, onSelectedValueChange, selectedValue, value, ...otherProps }: IGroupProps) => JSX.Element; export default RadioGroup;