Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion static/app/components/core/radio/radio.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ Use `<Radio>` for forms and settings where users must choose exactly one option

## Sizes

`<Radio>` comes in two sizes: `md` (default) and `sm` (small).
`<Radio>` comes in three sizes: `md` (default), `sm` (small), and `xs` (extra small).

export function SizesDemo() {
const [md, setMd] = useState(true);
const [sm, setSm] = useState(true);
const [xs, setXs] = useState(true);
return (
<Storybook.SideBySide>
<Flex as="label" align="center" gap="sm">
Expand All @@ -50,6 +51,10 @@ export function SizesDemo() {
Small
<Radio size="sm" checked={sm} onClick={() => setSm(!sm)} />
</Flex>
<Flex as="label" align="center" gap="sm">
Extra small
<Radio size="xs" checked={xs} onClick={() => setXs(!xs)} />
</Flex>
</Storybook.SideBySide>
);
}
Expand All @@ -61,6 +66,7 @@ export function SizesDemo() {
```jsx
<Radio checked={checked} onChange={handleChange} />
<Radio size="sm" checked={checked} onChange={handleChange} />
<Radio size="xs" checked={checked} onChange={handleChange} />
```

## States
Expand Down
4 changes: 2 additions & 2 deletions static/app/components/core/radio/radio.snapshots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const themes = {light: lightTheme, dark: darkTheme};

describe('Radio', () => {
describe.each(['light', 'dark'] as const)('theme-%s', themeName => {
it.snapshot.each<'sm' | 'md'>(['sm', 'md'])(
it.snapshot.each<'xs' | 'sm' | 'md'>(['xs', 'sm', 'md'])(
'size-%s-unchecked',
size => (
<ThemeProvider theme={themes[themeName]}>
Expand All @@ -21,7 +21,7 @@ describe('Radio', () => {
size => ({tags: {size, area: 'core'}})
);

it.snapshot.each<'sm' | 'md'>(['sm', 'md'])(
it.snapshot.each<'xs' | 'sm' | 'md'>(['xs', 'sm', 'md'])(
'size-%s-checked',
size => (
<ThemeProvider theme={themes[themeName]}>
Expand Down
6 changes: 5 additions & 1 deletion static/app/components/core/radio/radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ interface RadioProps extends Omit<
> {
nativeSize?: React.InputHTMLAttributes<HTMLInputElement>['size'];
ref?: React.Ref<HTMLInputElement>;
size?: 'sm' | 'md';
size?: 'xs' | 'sm' | 'md';
}

const radioConfig = {
xs: {
outerSize: '12px',
innerSize: '6px',
},
sm: {
outerSize: '20px',
innerSize: '10px',
Expand Down
Loading