Files
o11y-components/apps/docs/stories/dropdown-menu-sub-content.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

85 lines
2.6 KiB
TypeScript

import {
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from '@signozhq/ui';
import type { Meta, StoryObj } from '@storybook/react-vite';
const meta: Meta<typeof DropdownMenuSubContent> = {
title: 'Primitive Components/DropdownMenu/DropdownMenuSubContent',
component: DropdownMenuSubContent,
argTypes: {
sideOffset: {
control: 'number',
description: 'Distance in pixels from the sub trigger.',
table: { category: 'Positioning', defaultValue: { summary: '0' } },
},
alignOffset: {
control: 'number',
description: 'Offset in pixels from the alignment options.',
table: { category: 'Positioning', defaultValue: { summary: '0' } },
},
avoidCollisions: {
control: 'boolean',
description: 'When true, repositions to avoid collisions with viewport edges.',
table: { category: 'Positioning', defaultValue: { summary: 'true' } },
},
loop: {
control: 'boolean',
description: 'When true, keyboard navigation loops from last to first item.',
table: { category: 'Behavior', defaultValue: { summary: 'false' } },
},
className: {
control: 'text',
description: 'Additional CSS classes for the sub content.',
table: { category: 'Styling', type: { summary: 'string' } },
},
onEscapeKeyDown: { control: false, table: { category: 'Events' } },
onPointerDownOutside: { control: false, table: { category: 'Events' } },
onFocusOutside: { control: false, table: { category: 'Events' } },
onInteractOutside: { control: false, table: { category: 'Events' } },
children: { control: false, table: { category: 'Content' } },
},
parameters: {
layout: 'fullscreen',
},
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof DropdownMenuSubContent>;
export const Default: Story = {
args: {
sideOffset: 0,
avoidCollisions: true,
},
render: (args) => (
<div style={{ padding: 32 }}>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="solid" color="secondary">
Open menu
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem>Profile</DropdownMenuItem>
<DropdownMenuSub>
<DropdownMenuSubTrigger>More Options</DropdownMenuSubTrigger>
<DropdownMenuSubContent {...args}>
<DropdownMenuItem>Sub Item 1</DropdownMenuItem>
<DropdownMenuItem>Sub Item 2</DropdownMenuItem>
<DropdownMenuItem>Sub Item 3</DropdownMenuItem>
</DropdownMenuSubContent>
</DropdownMenuSub>
</DropdownMenuContent>
</DropdownMenu>
</div>
),
};