@spark-web/radio
Version:
--- title: Radio storybookPath: forms-radio--default isExperimentalPackage: true ---
54 lines (53 loc) • 2.18 kB
TypeScript
import type { Tone } from '@spark-web/field';
import type { ResponsiveProp, SparkTheme } from '@spark-web/theme';
import type { DataAttributeMap } from '@spark-web/utils/internal';
import type { InputHTMLAttributes, ReactNode } from 'react';
export declare type RadioSize = 'small' | 'medium';
declare type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value'>;
export declare type RadioPrimitiveProps = {
/** When true, the radio will be checked. */
checked?: boolean;
/** Sets data attributes for the element. */
data?: DataAttributeMap;
/** When true, the radio will be disabled. */
disabled?: boolean;
/** The size of the radio. */
size?: RadioSize;
/** The value of the radio. */
value?: string | boolean;
} & InputProps;
export declare type RadioProps = {
/** The radio label content. */
children: ReactNode;
} & RadioPrimitiveProps;
export declare type RadioGroupProps<Value extends string | boolean> = {
/** id(s) of the element(s) that describe the `Radio`. */
'aria-describedby'?: string;
/** defines a string value that can be used to name the `Radio`. */
'aria-label'?: string;
/** `Radio` components. */
children: ReactNode;
/** When true, disables the group of nested radios. */
disabled?: boolean;
/** An identifier which must be unique in the whole document. */
id?: string;
/** Provide a message, informing the user about changes in state. */
message?: string;
/** Name for the group of `Radio` components. */
name?: string;
/** Function that is fired whenever a change event is triggered on a `Radio`. */
onChange: (selectedValue: Value) => void;
/** The size of the nested radios. */
size?: RadioSize;
/** Provide a tone to influence elements of the field, and its input. */
tone?: Tone;
/** The value of the nested radios. */
value: Value;
};
export declare type RadioCardProps = Omit<RadioProps, 'id' | 'size'> & {
/** The radio description. */
description?: string;
/** The padding of the card content. */
padding?: ResponsiveProp<keyof SparkTheme['spacing']>;
};
export {};