Files
o11y-components/apps/docs/stories/select-portal.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

84 lines
2.0 KiB
TypeScript

import { Select, SelectContent, SelectItem, SelectPortal, SelectTrigger } from '@signozhq/ui';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { useState } from 'react';
const meta: Meta<typeof SelectPortal> = {
title: 'Primitive Components/Select/SelectPortal',
component: SelectPortal,
argTypes: {
container: {
description: 'The container element to render the portal into.',
table: {
category: 'Behavior',
type: { summary: 'HTMLElement' },
},
},
},
parameters: {
layout: 'fullscreen',
},
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof SelectPortal>;
const frameworks = [
{ value: 'react', label: 'React' },
{ value: 'vue', label: 'Vue' },
{ value: 'angular', label: 'Angular' },
];
export const Default: Story = {
render: () => {
const [value, setValue] = useState('');
return (
<div style={{ padding: 32, width: '100%', maxWidth: 384 }}>
<p
style={{
marginBottom: 16,
fontSize: 14,
lineHeight: 1.42857,
color: 'var(--muted-foreground)',
}}
>
SelectPortal renders the content in a portal (by default to document.body). This is useful
when the select is inside an overflow:hidden container. SelectContent uses this internally
via the withPortal prop.
</p>
<div
style={{
padding: 16,
borderStyle: 'solid',
borderWidth: 1,
borderRadius: 4,
overflow: 'hidden',
}}
>
<p
style={{
fontSize: 12,
lineHeight: 1.33333,
color: 'var(--muted-foreground)',
marginBottom: 8,
}}
>
This container has overflow:hidden, but the dropdown still shows outside.
</p>
<Select value={value} onChange={(v) => setValue(v as string)}>
<SelectTrigger placeholder="Select a framework..." />
<SelectContent>
{frameworks.map((f) => (
<SelectItem key={f.value} value={f.value}>
{f.label}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
</div>
);
},
};