Files
o11y-components/apps/docs/stories/radio-group-label.stories.tsx
zeekay 464e1eece0 State a version once
A version written into a manifest is written into every manifest that wants it,
which is how eslint came to exist in a hundred and four forms across this estate
and how a package came to resolve twice at run time. The catalog moves the number
out of the manifest: a manifest names the package, the workspace names the
version.

Four are held below their latest because the newer release cannot be used, and
the reason is recorded rather than the version alone: @noble/hashes 2 renamed
every subpath the web3 stack imports, @splinetool/runtime 2 depends on a package
that was never published, @dynamic-labs 5.4.1 the same, and react-resizable-panels
3 points its types condition at the bundle.
2026-09-15 11:45:32 -07:00

91 lines
2.6 KiB
TypeScript

import { RadioGroup, RadioGroupItem, RadioGroupLabel } from '@signozhq/ui';
import type { Meta, StoryObj } from '@storybook/react-vite';
const meta: Meta<typeof RadioGroupLabel> = {
title: 'Primitive Components/RadioGroup/RadioGroupLabel',
component: RadioGroupLabel,
argTypes: {
htmlFor: {
control: 'text',
description:
'The id of the radio item this label is associated with. Links the label to its radio button.',
table: { category: 'Accessibility', type: { summary: 'string' } },
},
id: {
control: 'text',
description: 'A unique identifier for the label element.',
table: { category: 'Accessibility' },
},
className: {
control: 'text',
description: 'Additional CSS classes to apply to the label.',
table: { category: 'Styling', type: { summary: 'string' } },
},
children: {
control: 'text',
description: 'The label text or content to display.',
table: { category: 'Content' },
},
},
parameters: {
layout: 'fullscreen',
},
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof RadioGroupLabel>;
export const Default: Story = {
args: {
htmlFor: 'radio-label-example',
children: 'Option Label',
},
render: (args) => (
<RadioGroup defaultValue="option1">
<div style={{ gap: 8, display: 'flex', alignItems: 'center' }}>
<RadioGroupItem value="option1" id="radio-label-example" />
<RadioGroupLabel {...args} />
</div>
</RadioGroup>
),
};
export const WithDisabledRadio: Story = {
args: {
htmlFor: 'disabled-radio-label',
children: 'Disabled Option',
},
render: (args) => (
<RadioGroup>
<div style={{ gap: 8, display: 'flex', alignItems: 'center' }}>
<RadioGroupItem value="disabled" id="disabled-radio-label" disabled />
<RadioGroupLabel {...args} aria-disabled="true" />
</div>
</RadioGroup>
),
};
export const MultipleLabels: Story = {
render: () => (
<RadioGroup defaultValue="option1">
<div style={{ gap: 12, display: 'flex', flexDirection: 'column' }}>
<div style={{ gap: 8, display: 'flex', alignItems: 'center' }}>
<RadioGroupItem value="option1" id="opt1" />
<RadioGroupLabel htmlFor="opt1">First Option</RadioGroupLabel>
</div>
<div style={{ gap: 8, display: 'flex', alignItems: 'center' }}>
<RadioGroupItem value="option2" id="opt2" />
<RadioGroupLabel htmlFor="opt2">Second Option</RadioGroupLabel>
</div>
<div style={{ gap: 8, display: 'flex', alignItems: 'center' }}>
<RadioGroupItem value="option3" id="opt3" disabled />
<RadioGroupLabel htmlFor="opt3" aria-disabled="true">
Disabled Option
</RadioGroupLabel>
</div>
</div>
</RadioGroup>
),
};