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

115 lines
3.2 KiB
TypeScript

import { Check, LogOut, Settings, User } from '@signozhq/icons';
import {
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuShortcut,
DropdownMenuTrigger,
} from '@signozhq/ui';
import type { Meta, StoryObj } from '@storybook/react-vite';
const meta: Meta<typeof DropdownMenuItem> = {
title: 'Primitive Components/DropdownMenu/DropdownMenuItem',
component: DropdownMenuItem,
argTypes: {
inset: {
control: 'boolean',
description: 'When true, adds additional left padding.',
table: { category: 'Appearance', defaultValue: { summary: 'false' } },
},
disabled: {
control: 'boolean',
description: 'When true, prevents the user from interacting with the item.',
table: { category: 'State', defaultValue: { summary: 'false' } },
},
destructive: {
control: 'boolean',
description: 'When true, the item is styled as destructive (e.g. delete actions).',
table: { category: 'Appearance', defaultValue: { summary: 'false' } },
},
className: {
control: 'text',
description: 'Additional CSS classes for the item.',
table: { category: 'Styling', type: { summary: 'string' } },
},
leftIcon: { control: false, table: { category: 'Content' } },
rightIcon: { control: false, table: { category: 'Content' } },
onSelect: { control: false, table: { category: 'Events' } },
children: { control: 'text', table: { category: 'Content' } },
},
parameters: {
layout: 'fullscreen',
},
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof DropdownMenuItem>;
export const Default: Story = {
args: {
children: 'Profile',
inset: false,
disabled: false,
destructive: false,
},
render: (args) => (
<div style={{ padding: 32 }}>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="solid" color="secondary">
Open menu
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem {...args} leftIcon={<User style={{ height: 16, width: 16 }} />} />
<DropdownMenuItem leftIcon={<Settings style={{ height: 16, width: 16 }} />}>
Settings
</DropdownMenuItem>
<DropdownMenuItem
destructive
leftIcon={<LogOut style={{ height: 16, width: 16 }} />}
onSelect={() => {}}
>
Logout
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
),
};
export const WithShortcut: Story = {
args: {
children: 'Profile',
inset: false,
disabled: false,
},
render: (args) => (
<div style={{ padding: 32 }}>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="solid" color="secondary">
Open menu
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem {...args} leftIcon={<User style={{ height: 16, width: 16 }} />}>
{args.children}
<DropdownMenuShortcut>โ‡งโŒ˜P</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuItem leftIcon={<Settings style={{ height: 16, width: 16 }} />}>
Settings
<DropdownMenuShortcut>โŒ˜S</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuItem leftIcon={<Check style={{ height: 16, width: 16 }} />}>
With checkmark
<DropdownMenuShortcut>โŒ˜K</DropdownMenuShortcut>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
),
};