Skip to content

Radio

Used to select one option from several options.

Selected:null
import { useState } from 'react';
import {
Radio,
type RadioOption,
} from '@fintech-sandpit/ui/react';
const [csp, setCsp] = useState<string | null>(null);
const options: RadioOption[] = [
{ label: 'AWS', value: 'aws' },
{ label: 'Azure', value: 'azure' },
{ label: 'GCP', value: 'gcp' },
{ label: 'Oracle (coming soon)', value: 'oracle', disabled: true },
];
return (
<Radio
value={csp}
options={options}
label="Select a cloud service provider:"
onChange={setCsp}
/>
);
NameTypeDefaultDescription
valuestringThe value of the radio field (controlled)
defaultValuestringThe default value of the radio field (uncontrolled)
optionsRadioOption[]The options of the radio field
labelstringThe label of the radio field
labelPositionLabelPositionleftThe position of the label
orientationOrientationverticalThe orientation of the radio field
sizeSizemdThe size of the radio field
variantRadioVariantsolidThe variant of the radio field
colorSchemeColorSchemeneutralThe color scheme of the radio field
requiredbooleanfalseWhether the radio field is required
readOnlybooleanfalseWhether the radio field is read-only
disabledbooleanfalseWhether the radio field is disabled
NameTypeDescription
onChange(value: string) => voidCallback fired when the value changes
type ColorScheme = 'neutral' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger'
type LabelPosition = 'left' | 'right'
type Orientation = 'horizontal' | 'vertical'
type RadioOption = {
label: string;
value: string;
disabled?: boolean;
}
type RadioVariant = 'solid' | 'subtle' | 'outline'
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'