# Dropdown Menu

Displays a menu to the user, such as a set of actions or functions, triggered by a button.

Section: Components / Overlays
Page: https://ui.heyramzi.com/components/dropdown-menu
Import path: `@heyramzi/ui/shadcn/dropdown-menu`

## Import

```ts
import * as DropdownMenu from "@heyramzi/ui/shadcn/dropdown-menu";
import { Button } from "@heyramzi/ui/shadcn/button";
```

## Usage

```svelte
<DropdownMenu.Root>
  <DropdownMenu.Trigger>Open</DropdownMenu.Trigger>
  <DropdownMenu.Content align="start">
    <DropdownMenu.Label>My account</DropdownMenu.Label>
    <DropdownMenu.Group>
      <DropdownMenu.Item>
        Profile
        <DropdownMenu.Shortcut>⇧⌘P</DropdownMenu.Shortcut>
      </DropdownMenu.Item>
      <DropdownMenu.Item>Billing</DropdownMenu.Item>
    </DropdownMenu.Group>
    <DropdownMenu.Separator />
    <DropdownMenu.Item>Log out</DropdownMenu.Item>
  </DropdownMenu.Content>
</DropdownMenu.Root>
```

## Demo

```svelte
<script lang="ts">
	import * as DropdownMenu from "@heyramzi/ui/shadcn/dropdown-menu";
	import { Button } from "@heyramzi/ui/shadcn/button";
</script>

<DropdownMenu.Root>
	<DropdownMenu.Trigger>
		{#snippet child({ props })}
			<Button {...props} variant="outline">Open</Button>
		{/snippet}
	</DropdownMenu.Trigger>
	<DropdownMenu.Content class="w-56" align="start">
		<DropdownMenu.Label>My Account</DropdownMenu.Label>
		<DropdownMenu.Group>
			<DropdownMenu.Item>
				Profile
				<DropdownMenu.Shortcut>⇧⌘P</DropdownMenu.Shortcut>
			</DropdownMenu.Item>
			<DropdownMenu.Item>
				Billing
				<DropdownMenu.Shortcut>⌘B</DropdownMenu.Shortcut>
			</DropdownMenu.Item>
			<DropdownMenu.Item>
				Settings
				<DropdownMenu.Shortcut>⌘S</DropdownMenu.Shortcut>
			</DropdownMenu.Item>
			<DropdownMenu.Item>
				Keyboard shortcuts
				<DropdownMenu.Shortcut>⌘K</DropdownMenu.Shortcut>
			</DropdownMenu.Item>
		</DropdownMenu.Group>
		<DropdownMenu.Separator />
		<DropdownMenu.Group>
			<DropdownMenu.Item>Team</DropdownMenu.Item>
			<DropdownMenu.Sub>
				<DropdownMenu.SubTrigger>Invite users</DropdownMenu.SubTrigger>
				<DropdownMenu.SubContent>
					<DropdownMenu.Item>Email</DropdownMenu.Item>
					<DropdownMenu.Item>Message</DropdownMenu.Item>
					<DropdownMenu.Separator />
					<DropdownMenu.Item>More...</DropdownMenu.Item>
				</DropdownMenu.SubContent>
			</DropdownMenu.Sub>
			<DropdownMenu.Item>
				New Team
				<DropdownMenu.Shortcut>⌘+T</DropdownMenu.Shortcut>
			</DropdownMenu.Item>
		</DropdownMenu.Group>
		<DropdownMenu.Separator />
		<DropdownMenu.Item>GitHub</DropdownMenu.Item>
		<DropdownMenu.Item>Support</DropdownMenu.Item>
		<DropdownMenu.Item disabled>API</DropdownMenu.Item>
		<DropdownMenu.Separator />
		<DropdownMenu.Item>
			Log out
			<DropdownMenu.Shortcut>⇧⌘Q</DropdownMenu.Shortcut>
		</DropdownMenu.Item>
	</DropdownMenu.Content>
</DropdownMenu.Root>
```

## API

### DropdownMenu.CheckboxGroup

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `value` |  | `[]` | bindable |

Every prop of `DropdownMenu.CheckboxGroup` from `bits-ui`.

### DropdownMenu.Trigger

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |

Every prop of `DropdownMenu.Trigger` from `bits-ui`.

### DropdownMenu.Content

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `portalProps` | `WithoutChildrenOrChild<ComponentProps<typeof DropdownMenuPortal>>` |  |  |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `sideOffset` | `number` | `4` |  |
| `align` | `string` | `"start"` |  |
| `collisionPadding` | `number` | `8` |  |
| `class` | `string` |  |  |

Every prop of `DropdownMenu.Content` from `bits-ui`.

### DropdownMenu.Label

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `inset` | `boolean` |  |  |
| `ref` | `HTMLDivElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLDivElement>` from `svelte/elements`.

### DropdownMenu.Group

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |

Every prop of `DropdownMenu.Group` from `bits-ui`.

### DropdownMenu.Item

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `inset` | `boolean` |  |  |
| `variant` | `"default" \| "destructive"` | `"default"` |  |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `DropdownMenu.Item` from `bits-ui`.

### DropdownMenu.Shortcut

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLSpanElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `HTMLAttributes<HTMLSpanElement>` from `svelte/elements`.

### DropdownMenu.Separator

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `DropdownMenu.Separator` from `bits-ui`.

### DropdownMenu.Sub

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `open` | `boolean` | `false` | bindable |

Every prop of `DropdownMenu.Sub` from `bits-ui`.

### DropdownMenu.SubTrigger

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `inset` | `boolean` |  |  |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `DropdownMenu.SubTrigger` from `bits-ui`.

### DropdownMenu.SubContent

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `DropdownMenu.SubContent` from `bits-ui`.

### DropdownMenu.CheckboxItem

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `children` | `Snippet` |  |  |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `checked` | `boolean` | `false` | bindable |
| `indeterminate` | `boolean` | `false` | bindable |
| `class` | `string` |  |  |

Every prop of `DropdownMenu.CheckboxItem` from `bits-ui`, except `child, children`.

### DropdownMenu.Portal

Every prop of `DropdownMenu.Portal` from `bits-ui`.

### DropdownMenu.DropdownMenu

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `open` | `boolean` | `false` | bindable |

Every prop of `DropdownMenu.Root` from `bits-ui`.

### DropdownMenu.RadioGroup

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `value` |  |  | bindable |

Every prop of `DropdownMenu.RadioGroup` from `bits-ui`.

### DropdownMenu.RadioItem

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |
| `children` | `Snippet` |  |  |

Every prop of `DropdownMenu.RadioItem` from `bits-ui`, except `child`.

### DropdownMenu.GroupHeading

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `inset` | `boolean` |  |  |
| `ref` | `HTMLElement \| null` | `null` | bindable |
| `class` | `string` |  |  |

Every prop of `DropdownMenu.GroupHeading` from `bits-ui`.
