# Menus and tooltips · Divan

> Everything that floats sits on bg-popover, a lighter tone, with no shadow. Menus group items with space and a small heading, never divider lines.

Part of Divan, the DivanWorks design system. Web page: https://brand.divanworks.com/menus · All topics: https://brand.divanworks.com/llms.txt

## Rules

- DropdownMenu for actions on a thing; Popover for a little more explanation; Tooltip to name an icon button.
- Pass dir to floating content on Persian pages (it renders in a portal outside the page’s dir).
- Destructive menu items use variant="destructive" (red text).

## Components

### DropdownMenu

Actions on a thing. Groups (DropdownMenu.Group, with a Label when it helps) are set apart by space; no Separator. It opens in the page’s direction by itself.

```ts
import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
```

```svelte
<DropdownMenu.Root>
	<DropdownMenu.Trigger>{#snippet child({ props })}<Button variant="ghost" size="icon" aria-label="More" {...props}><EllipsisIcon /></Button>{/snippet}</DropdownMenu.Trigger>
	<DropdownMenu.Content>
		<DropdownMenu.Group>
			<DropdownMenu.Label>Campaign</DropdownMenu.Label>
			<DropdownMenu.Item>Edit campaign</DropdownMenu.Item>
		</DropdownMenu.Group>
		<DropdownMenu.Group>
			<DropdownMenu.Item variant="destructive">Delete campaign…</DropdownMenu.Item>
		</DropdownMenu.Group>
	</DropdownMenu.Content>
</DropdownMenu.Root>
```

### Popover

A little more explanation on demand.

```ts
import * as Popover from '#lib/components/ui/popover/index.js';
```

```svelte
<Popover.Root>
	<Popover.Trigger>{#snippet child({ props })}<Button variant="plain" {...props}>How does this work?</Button>{/snippet}</Popover.Trigger>
	<Popover.Content dir={dir}>…</Popover.Content>
</Popover.Root>
```

### Tooltip

Naming an icon button. Needs Tooltip.Provider higher up.

```ts
import * as Tooltip from '#lib/components/ui/tooltip/index.js';
```

```svelte
<Tooltip.Root>
	<Tooltip.Trigger>{#snippet child({ props })}<Button variant="secondary" size="icon" aria-label="Copy" {...props}><CopyIcon /></Button>{/snippet}</Tooltip.Trigger>
	<Tooltip.Content>Copy your account code</Tooltip.Content>
</Tooltip.Root>
```
