@ray-js/components
Version:
Ray basic components
38 lines (37 loc) • 1.1 kB
TypeScript
import { BaseProps } from '../types';
import { RadioProps } from '../Radio/props';
import { GenericEvent } from '@ray-js/adapter';
export type RadioGroupOption = RadioProps & {
label: string;
};
export interface IRadioGroupWithOptions {
options: RadioGroupOption[];
children?: undefined;
}
export interface IRadioGroupWithChildren {
options?: undefined;
children: React.ReactNode | React.ReactNode[] | string;
}
export type RadioGroupProps = (IRadioGroupWithOptions & BaseRadioGroupProps) | (IRadioGroupWithChildren & BaseRadioGroupProps);
export interface BaseRadioGroupProps extends Omit<BaseProps, 'children'> {
/**
* @description.en name
* @description.zh 姓名
* @default undefined
*/
name?: string;
/**
* @description.en disabled
* @description.zh 是否禁用
* @default false
*/
disabled?: boolean;
/**
* @description.en onChange
* @description.zh 选中项发生改变时触发 change 事件
* @default undefined
*/
onChange?: (event: GenericEvent<{
value: any;
}>) => void;
}