Divan

Components

Menus and tooltips

Everything that floats sits on the raised surface, a lighter tone, with no shadow. Menus group their items with space and a small heading, never with divider lines.

Menu

Open it. Items in a group sit close; groups are separated by space.

Popover and tooltip

A tooltip names an icon button. A popover holds a little more, like how to send your code.

Code

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.

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

<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.

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

<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.

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

<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>