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.
49 lines
1023 B
Plaintext
49 lines
1023 B
Plaintext
import { Meta, Controls, Primary } from '@storybook/addon-docs/blocks';
|
|
import * as ToggleStories from './toggle.stories';
|
|
|
|
<Meta of={ToggleStories} />
|
|
|
|
# Toggle
|
|
|
|
A two-state button that can be toggled on or off. For grouped toggles, use ToggleGroup with ToggleGroupItem or ToggleGroupSimple.
|
|
|
|
## How to use
|
|
|
|
### Standalone toggle
|
|
|
|
```tsx
|
|
import { Toggle } from '@signozhq/ui';
|
|
import { Bold } from '@signozhq/icons';
|
|
|
|
export default function MyComponent() {
|
|
return (
|
|
<Toggle aria-label="Toggle bold" defaultValue={false}>
|
|
<Bold style={{ height: 12, width: 12 }} />
|
|
</Toggle>
|
|
);
|
|
}
|
|
```
|
|
|
|
### Controlled
|
|
|
|
```tsx
|
|
import { Toggle } from '@signozhq/ui';
|
|
import { Bold } from '@signozhq/icons';
|
|
|
|
export default function MyComponent() {
|
|
const [bold, setBold] = React.useState(false);
|
|
|
|
return (
|
|
<Toggle aria-label="Toggle bold" value={bold} onChange={setBold}>
|
|
<Bold style={{ height: 12, width: 12 }} />
|
|
</Toggle>
|
|
);
|
|
}
|
|
```
|
|
|
|
<Primary />
|
|
|
|
## Toggle Props
|
|
|
|
<Controls of={ToggleStories.Default} />
|