mirror of
https://github.com/hanzoai/o11y-components.git
synced 2026-10-30 14:54:15 +00:00
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.
76 lines
2.3 KiB
Plaintext
76 lines
2.3 KiB
Plaintext
import { Meta, Controls, Primary } from '@storybook/addon-docs/blocks';
|
|
import * as RadioGroupStories from './radio-group.stories';
|
|
import * as RadioGroupItemStories from './radio-group-item.stories';
|
|
import * as RadioGroupLabelStories from './radio-group-label.stories';
|
|
|
|
<Meta of={RadioGroupStories} />
|
|
|
|
# RadioGroup
|
|
|
|
A radio group component for selecting a single option from a list of choices.
|
|
|
|
## How to use
|
|
|
|
### Basic usage (with inline labels)
|
|
|
|
```tsx
|
|
import { RadioGroup, RadioGroupItem } from '@signozhq/ui';
|
|
|
|
export default function MyComponent() {
|
|
return (
|
|
<RadioGroup defaultValue="option1">
|
|
<RadioGroupItem value="option1">Option 1</RadioGroupItem>
|
|
<RadioGroupItem value="option2">Option 2</RadioGroupItem>
|
|
<RadioGroupItem value="option3">Option 3</RadioGroupItem>
|
|
</RadioGroup>
|
|
);
|
|
}
|
|
```
|
|
|
|
When you pass children to `RadioGroupItem`, it automatically renders an inline label associated with the radio button.
|
|
|
|
### With RadioGroupLabel (for custom layouts)
|
|
|
|
If you prefer to use separate label elements for more control over styling or layout, use the `RadioGroupLabel` component:
|
|
|
|
```tsx
|
|
import { RadioGroup, RadioGroupItem, RadioGroupLabel } from '@signozhq/ui';
|
|
|
|
export default function MyComponent() {
|
|
return (
|
|
<RadioGroup defaultValue="option1">
|
|
<div style={{ gap: 8, display: 'flex', alignItems: 'center' }}>
|
|
<RadioGroupItem value="option1" id="option1-radio" />
|
|
<RadioGroupLabel htmlFor="option1-radio">Option 1</RadioGroupLabel>
|
|
</div>
|
|
<div style={{ gap: 8, display: 'flex', alignItems: 'center' }}>
|
|
<RadioGroupItem value="option2" id="option2-radio" />
|
|
<RadioGroupLabel htmlFor="option2-radio">Option 2</RadioGroupLabel>
|
|
</div>
|
|
<div style={{ gap: 8, display: 'flex', alignItems: 'center' }}>
|
|
<RadioGroupItem value="option3" id="option3-radio" disabled />
|
|
<RadioGroupLabel htmlFor="option3-radio" aria-disabled="true">
|
|
Option 3 (Disabled)
|
|
</RadioGroupLabel>
|
|
</div>
|
|
</RadioGroup>
|
|
);
|
|
}
|
|
```
|
|
|
|
This following example shows a radio group with three options (using code from first example above):
|
|
|
|
<Primary />
|
|
|
|
## RadioGroup Props
|
|
|
|
<Controls of={RadioGroupStories.Default} />
|
|
|
|
## RadioGroupItem Props
|
|
|
|
<Controls of={RadioGroupItemStories.Default} />
|
|
|
|
## RadioGroupLabel Props
|
|
|
|
<Controls of={RadioGroupLabelStories.Default} />
|