UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

56 lines (55 loc) 2.61 kB
import { DataAttributes, Factory, MantineSize } from '../../../core'; import { InputWrapperProps, InputWrapperStylesNames } from '../../Input'; export interface RadioGroupContextValue<Value extends string = string> { size: MantineSize | undefined; value: Value | null; onChange: (event: React.ChangeEvent<HTMLInputElement> | string) => void; name: string; disabled: boolean | undefined; } export declare const RadioGroupContext: import("react").Context<RadioGroupContextValue<string> | null>; export type RadioGroupStylesNames = InputWrapperStylesNames; export interface RadioGroupProps<Value extends string = string> extends Omit<InputWrapperProps, 'onChange' | 'value' | 'defaultValue'> { /** `Radio` components and any other elements */ children: React.ReactNode; /** Controlled component value */ value?: Value | null; /** Uncontrolled component default value */ defaultValue?: Value | null; /** Called when value changes */ onChange?: (value: Value) => void; /** Props passed down to the `Input.Wrapper` */ wrapperProps?: React.ComponentProps<'div'> & DataAttributes; /** Controls size of the `Input.Wrapper` @default 'sm' */ size?: MantineSize; /** `name` attribute of child radio inputs. By default, `name` is generated randomly. */ name?: string; /** If set, value cannot be changed */ readOnly?: boolean; /** Sets `disabled` attribute, prevents interactions */ disabled?: boolean; } export type RadioGroupFactory = Factory<{ props: RadioGroupProps; ref: HTMLDivElement; stylesNames: RadioGroupStylesNames; signature: <Value extends string = string>(props: RadioGroupProps<Value>) => React.JSX.Element; }>; export declare const RadioGroup: (<Value extends string = string>(props: RadioGroupProps<Value>) => React.JSX.Element) & import("../../..").ThemeExtend<{ props: RadioGroupProps; ref: HTMLDivElement; stylesNames: RadioGroupStylesNames; signature: <Value extends string = string>(props: RadioGroupProps<Value>) => React.JSX.Element; }> & import("../../..").ComponentClasses<{ props: RadioGroupProps; ref: HTMLDivElement; stylesNames: RadioGroupStylesNames; signature: <Value extends string = string>(props: RadioGroupProps<Value>) => React.JSX.Element; }> & Record<string, never> & import("../../..").FactoryComponentWithProps<{ props: RadioGroupProps; ref: HTMLDivElement; stylesNames: RadioGroupStylesNames; signature: <Value extends string = string>(props: RadioGroupProps<Value>) => React.JSX.Element; }> & { displayName?: string; };