Menubar
Organizes and presents a collection of menu options or actions within a horizontal bar.
<script lang="ts">
import { Menubar } from "$lib";
import { flyAndScale } from "@/utils";
import { SwitchOn, SwitchOff } from "@/components//icons";
import { CaretRight, Cat, Check } from "phosphor-svelte";
let bookmarks = false;
let fullUrls = true;
let pixelGrid = true;
let layoutGrid = false;
let view = "table";
let profile = "pavel";
</script>
<Menubar.Root
class="flex h-12 items-center gap-1 rounded-[10px] border border-dark-10 bg-background px-[3px] shadow-mini"
>
<div class="px-[10px]">
<Cat class="sq-6" />
</div>
<Menubar.Menu>
<Menubar.Trigger
class="inline-flex h-10 cursor-default items-center justify-center rounded-[9px] px-3 text-sm font-medium outline-none data-[highlighted]:bg-muted data-[state=open]:bg-muted"
>View</Menubar.Trigger
>
<Menubar.Content
class="z-50 w-full max-w-[220px] rounded-xl border border-muted bg-background px-1 py-1.5 shadow-popover outline-none"
transition={flyAndScale}
align="start"
sideOffset={3}
>
<Menubar.CheckboxItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
bind:checked={pixelGrid}
>
Pixel grid
<Menubar.CheckboxIndicator class="ml-auto">
<SwitchOn />
</Menubar.CheckboxIndicator>
{#if !pixelGrid}
<div class="ml-auto">
<SwitchOff />
</div>
{/if}
</Menubar.CheckboxItem>
<Menubar.CheckboxItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
bind:checked={layoutGrid}
>
Layout grid
<Menubar.CheckboxIndicator class="ml-auto">
<SwitchOn />
</Menubar.CheckboxIndicator>
{#if !layoutGrid}
<div class="ml-auto">
<SwitchOff />
</div>
{/if}
</Menubar.CheckboxItem>
<Menubar.Separator class="my-1 -ml-1 -mr-1 block h-px bg-muted" />
<Menubar.RadioGroup bind:value={view}>
<Menubar.RadioItem
value="table"
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>
Table
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
<Menubar.RadioItem
value="board"
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>
Board
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
<Menubar.RadioItem
value="gallery"
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>
Gallery
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
</Menubar.RadioGroup>
</Menubar.Content>
</Menubar.Menu>
<Menubar.Menu>
<Menubar.Trigger
class="inline-flex h-10 cursor-default items-center justify-center rounded-[9px] px-3 text-sm font-medium outline-none data-[highlighted]:bg-muted data-[state=open]:bg-muted"
>Edit</Menubar.Trigger
>
<Menubar.Content
class="z-50 w-full max-w-[220px] rounded-xl border border-muted bg-background px-1 py-1.5 shadow-popover outline-none"
transition={flyAndScale}
align="start"
sideOffset={3}
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Undo</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Redo</Menubar.Item
>
<Menubar.Separator />
<Menubar.Sub>
<Menubar.SubTrigger
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted data-[state=open]:bg-muted"
>
Find
<div class="ml-auto flex items-center gap-px">
<CaretRight class="h-4 w-4 text-foreground-alt" />
</div>
</Menubar.SubTrigger>
<Menubar.SubContent
class="w-full max-w-[209px] rounded-xl border border-muted bg-background px-1 py-1.5 shadow-popover outline-none"
transition={flyAndScale}
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Search the web</Menubar.Item
>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Find...</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Find Next</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Find Previous</Menubar.Item
>
</Menubar.SubContent>
</Menubar.Sub>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Cut</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Copy</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Paste</Menubar.Item
>
</Menubar.Content>
</Menubar.Menu>
<Menubar.Menu>
<Menubar.Trigger
class="inline-flex h-10 cursor-default items-center justify-center rounded-[9px] px-3 text-sm font-medium outline-none data-[highlighted]:bg-muted data-[state=open]:bg-muted"
>View</Menubar.Trigger
>
<Menubar.Content
class="z-50 w-full max-w-[220px] rounded-xl border border-muted bg-background px-1 py-1.5 shadow-popover outline-none"
transition={flyAndScale}
align="start"
sideOffset={3}
>
<Menubar.CheckboxItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
bind:checked={bookmarks}
>
Show Bookmarks Bar
<Menubar.CheckboxIndicator class="ml-auto">
<SwitchOn />
</Menubar.CheckboxIndicator>
{#if !bookmarks}
<div class="ml-auto">
<SwitchOff />
</div>
{/if}
</Menubar.CheckboxItem>
<Menubar.CheckboxItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
bind:checked={fullUrls}
>
Show Full URLs
<Menubar.CheckboxIndicator class="ml-auto">
<SwitchOn />
</Menubar.CheckboxIndicator>
{#if !fullUrls}
<div class="ml-auto">
<SwitchOff />
</div>
{/if}
</Menubar.CheckboxItem>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Reload</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Force Reload</Menubar.Item
>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Toggle Fullscreen</Menubar.Item
>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Hide Sidebar</Menubar.Item
>
</Menubar.Content>
</Menubar.Menu>
<Menubar.Menu>
<Menubar.Trigger
class="mr-[20px] inline-flex h-10 cursor-default items-center justify-center rounded-[9px] px-3 text-sm font-medium outline-none data-[highlighted]:bg-muted data-[state=open]:bg-muted"
>Profiles</Menubar.Trigger
>
<Menubar.Content
class="z-50 w-full max-w-[220px] rounded-xl border border-muted bg-background px-1 py-1.5 shadow-popover outline-none"
transition={flyAndScale}
align="start"
sideOffset={3}
>
<Menubar.RadioGroup bind:value={profile}>
<Menubar.RadioItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
value="hunter"
>
Hunter
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
<Menubar.RadioItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
value="pavel"
>
Pavel
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
<Menubar.RadioItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
value="adrian"
>
Adrian
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
</Menubar.RadioGroup>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Edit...</Menubar.Item
>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Add Profile...</Menubar.Item
>
</Menubar.Content>
</Menubar.Menu>
</Menubar.Root>
<script lang="ts">
import { Menubar } from "$lib";
import { flyAndScale } from "@/utils";
import { SwitchOn, SwitchOff } from "@/components//icons";
import { CaretRight, Cat, Check } from "phosphor-svelte";
let bookmarks = false;
let fullUrls = true;
let pixelGrid = true;
let layoutGrid = false;
let view = "table";
let profile = "pavel";
</script>
<Menubar.Root
class="flex h-12 items-center gap-1 rounded-[10px] border border-dark-10 bg-background px-[3px] shadow-mini"
>
<div class="px-[10px]">
<Cat class="sq-6" />
</div>
<Menubar.Menu>
<Menubar.Trigger
class="inline-flex h-10 cursor-default items-center justify-center rounded-[9px] px-3 text-sm font-medium outline-none data-[highlighted]:bg-muted data-[state=open]:bg-muted"
>View</Menubar.Trigger
>
<Menubar.Content
class="z-50 w-full max-w-[220px] rounded-xl border border-muted bg-background px-1 py-1.5 shadow-popover outline-none"
transition={flyAndScale}
align="start"
sideOffset={3}
>
<Menubar.CheckboxItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
bind:checked={pixelGrid}
>
Pixel grid
<Menubar.CheckboxIndicator class="ml-auto">
<SwitchOn />
</Menubar.CheckboxIndicator>
{#if !pixelGrid}
<div class="ml-auto">
<SwitchOff />
</div>
{/if}
</Menubar.CheckboxItem>
<Menubar.CheckboxItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
bind:checked={layoutGrid}
>
Layout grid
<Menubar.CheckboxIndicator class="ml-auto">
<SwitchOn />
</Menubar.CheckboxIndicator>
{#if !layoutGrid}
<div class="ml-auto">
<SwitchOff />
</div>
{/if}
</Menubar.CheckboxItem>
<Menubar.Separator class="my-1 -ml-1 -mr-1 block h-px bg-muted" />
<Menubar.RadioGroup bind:value={view}>
<Menubar.RadioItem
value="table"
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>
Table
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
<Menubar.RadioItem
value="board"
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>
Board
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
<Menubar.RadioItem
value="gallery"
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>
Gallery
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
</Menubar.RadioGroup>
</Menubar.Content>
</Menubar.Menu>
<Menubar.Menu>
<Menubar.Trigger
class="inline-flex h-10 cursor-default items-center justify-center rounded-[9px] px-3 text-sm font-medium outline-none data-[highlighted]:bg-muted data-[state=open]:bg-muted"
>Edit</Menubar.Trigger
>
<Menubar.Content
class="z-50 w-full max-w-[220px] rounded-xl border border-muted bg-background px-1 py-1.5 shadow-popover outline-none"
transition={flyAndScale}
align="start"
sideOffset={3}
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Undo</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Redo</Menubar.Item
>
<Menubar.Separator />
<Menubar.Sub>
<Menubar.SubTrigger
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted data-[state=open]:bg-muted"
>
Find
<div class="ml-auto flex items-center gap-px">
<CaretRight class="h-4 w-4 text-foreground-alt" />
</div>
</Menubar.SubTrigger>
<Menubar.SubContent
class="w-full max-w-[209px] rounded-xl border border-muted bg-background px-1 py-1.5 shadow-popover outline-none"
transition={flyAndScale}
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Search the web</Menubar.Item
>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Find...</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Find Next</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Find Previous</Menubar.Item
>
</Menubar.SubContent>
</Menubar.Sub>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Cut</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Copy</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Paste</Menubar.Item
>
</Menubar.Content>
</Menubar.Menu>
<Menubar.Menu>
<Menubar.Trigger
class="inline-flex h-10 cursor-default items-center justify-center rounded-[9px] px-3 text-sm font-medium outline-none data-[highlighted]:bg-muted data-[state=open]:bg-muted"
>View</Menubar.Trigger
>
<Menubar.Content
class="z-50 w-full max-w-[220px] rounded-xl border border-muted bg-background px-1 py-1.5 shadow-popover outline-none"
transition={flyAndScale}
align="start"
sideOffset={3}
>
<Menubar.CheckboxItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
bind:checked={bookmarks}
>
Show Bookmarks Bar
<Menubar.CheckboxIndicator class="ml-auto">
<SwitchOn />
</Menubar.CheckboxIndicator>
{#if !bookmarks}
<div class="ml-auto">
<SwitchOff />
</div>
{/if}
</Menubar.CheckboxItem>
<Menubar.CheckboxItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
bind:checked={fullUrls}
>
Show Full URLs
<Menubar.CheckboxIndicator class="ml-auto">
<SwitchOn />
</Menubar.CheckboxIndicator>
{#if !fullUrls}
<div class="ml-auto">
<SwitchOff />
</div>
{/if}
</Menubar.CheckboxItem>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Reload</Menubar.Item
>
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Force Reload</Menubar.Item
>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Toggle Fullscreen</Menubar.Item
>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Hide Sidebar</Menubar.Item
>
</Menubar.Content>
</Menubar.Menu>
<Menubar.Menu>
<Menubar.Trigger
class="mr-[20px] inline-flex h-10 cursor-default items-center justify-center rounded-[9px] px-3 text-sm font-medium outline-none data-[highlighted]:bg-muted data-[state=open]:bg-muted"
>Profiles</Menubar.Trigger
>
<Menubar.Content
class="z-50 w-full max-w-[220px] rounded-xl border border-muted bg-background px-1 py-1.5 shadow-popover outline-none"
transition={flyAndScale}
align="start"
sideOffset={3}
>
<Menubar.RadioGroup bind:value={profile}>
<Menubar.RadioItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
value="hunter"
>
Hunter
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
<Menubar.RadioItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
value="pavel"
>
Pavel
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
<Menubar.RadioItem
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
value="adrian"
>
Adrian
<Menubar.RadioIndicator class="ml-auto">
<Check class="sq-5" />
</Menubar.RadioIndicator>
</Menubar.RadioItem>
</Menubar.RadioGroup>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Edit...</Menubar.Item
>
<Menubar.Separator />
<Menubar.Item
class="flex h-10 select-none items-center rounded-button py-3 pl-3 pr-1.5 text-sm font-medium outline-none data-[highlighted]:bg-muted"
>Add Profile...</Menubar.Item
>
</Menubar.Content>
</Menubar.Menu>
</Menubar.Root>
Structure
<script lang="ts">
import { Menubar } from "bits-ui";
</script>
<Menubar.Root>
<Menubar.Menu>
<Menubar.Trigger />
<Menubar.Content>
<Menubar.Label />
<Menubar.Item />
<Menubar.Group>
<Menubar.Item />
</Menubar.Group>
<Menubar.CheckboxItem>
<Menubar.CheckboxIndicator />
</Menubar.CheckboxItem>
<Menubar.RadioGroup>
<Menubar.RadioItem>
<Menubar.RadioIndicator />
<Menubar.RadioItem>
</Menubar.RadioGroup>
<Menubar.Sub>
<Menubar.SubTrigger />
<Menubar.SubContent />
</Menubar.Sub>
<Menubar.Separator />
<Menubar.Arrow />
</Menubar.Content>
</Menubar.Menu>
</Menubar.Root>
<script lang="ts">
import { Menubar } from "bits-ui";
</script>
<Menubar.Root>
<Menubar.Menu>
<Menubar.Trigger />
<Menubar.Content>
<Menubar.Label />
<Menubar.Item />
<Menubar.Group>
<Menubar.Item />
</Menubar.Group>
<Menubar.CheckboxItem>
<Menubar.CheckboxIndicator />
</Menubar.CheckboxItem>
<Menubar.RadioGroup>
<Menubar.RadioItem>
<Menubar.RadioIndicator />
<Menubar.RadioItem>
</Menubar.RadioGroup>
<Menubar.Sub>
<Menubar.SubTrigger />
<Menubar.SubContent />
</Menubar.Sub>
<Menubar.Separator />
<Menubar.Arrow />
</Menubar.Content>
</Menubar.Menu>
</Menubar.Root>
Component API
The root menubar component which manages & scopes the state of the menubar.
Property | Type | Description |
---|---|---|
closeOnEscape | boolean | Whether to close the open menubar menu when the escape key is pressed. Default:
true |
loop | boolean | Whether or not to loop through the menubar menu triggers when navigating with the keyboard. Default:
true |
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
ids | object | The ids of the elements within the component, useful when you don't necessarily want to provide a custom ID, but still want access to the ID being assigned (if any). |
A menu within the menubar.
Property | Type | Description |
---|---|---|
preventScroll | boolean | Whether or not to prevent scroll on the body when the menu is open. Default:
true |
closeOnEscape | boolean | Whether to close the menu when the escape key is pressed. Default:
true |
closeOnOutsideClick | boolean | Whether to close the menu when a click occurs outside of it. Default:
true |
loop | boolean | Whether or not to loop through the menu items when navigating with the keyboard. Default:
false |
open | boolean | The open state of the menu. Default:
false |
onOpenChange | function | A callback that is fired when the menu's open state changes. Default:
—— undefined |
dir | enum | The direction of the menu. Default:
—— undefined |
portal | union | Where to render the menu when it is open. Defaults to the body. Can be disabled by passing Default:
—— undefined |
closeFocus | FocusProp | Override the focus when the menu is closed. Default:
—— undefined |
typeahead | boolean | Whether or not to enable typeahead functionality. When enabled, the user can type to navigate to menu items. Default:
true |
disableFocusFirstItem | boolean | Whether or not to disable focus on the first item when the menu is opened. Default:
false |
Slot Property | Type | Description |
---|---|---|
ids | object | The ids of the elements within the component, useful when you don't necessarily want to provide a custom ID, but still want access to the ID being assigned (if any). |
The button element which toggles the dropdown menu.
Property | Type | Description |
---|---|---|
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-state | enum | The open state of the menu or submenu the element controls or belongs to. |
data-menu-trigger | —— | Present on the trigger element. |
The content displayed when the dropdown menu is open.
Property | Type | Description |
---|---|---|
transition | function | A Svelte transition function to use when transitioning the content in and out. Default:
—— undefined |
transitionConfig | TransitionConfig | The configuration to apply to the transition. Default:
—— undefined |
inTransition | function | A Svelte transition function to use when transitioning the content in and out. Default:
—— undefined |
inTransitionConfig | TransitionConfig | The configuration to apply to the transition. Default:
—— undefined |
outTransition | function | A Svelte transition function to use when transitioning the content in and out. Default:
—— undefined |
outTransitionConfig | TransitionConfig | The configuration to apply to the transition. Default:
—— undefined |
side | enum | The preferred side of the anchor to render against when open. Will be reversed when collisions occur. Floating UI reference. Default:
—— undefined |
sideOffset | number | The amount of offset to apply to the menu's position on the x-axis. Floating UI reference. Default:
0 |
align | enum | The preferred alignment of the anchor to render against when open. Floating UI reference. Default:
—— undefined |
alignOffset | number | An offset in pixels from the 'start' or 'end' alignment options. Floating UI reference. Default:
0 |
avoidCollisions | boolean | When Default:
true |
collisionBoundary | union | A boundary element or array of elements to check for collisions against. Floating UI reference. Default:
—— undefined |
collisionPadding | number | The amount in pixels of virtual padding around the viewport edges to check for overflow which will cause a collision. Floating UI reference. Default:
0 |
fitViewport | boolean | Whether the floating element should be constrained to the viewport. Floating UI reference. Default:
false |
sameWidth | boolean | Whether the content should be the same width as the trigger. Floating UI reference. Default:
false |
strategy | enum | The positioning strategy to use for the floating element. Floating UI reference. Default:
absolute |
overlap | boolean | Whether the floating element can overlap the reference element. Floating UI reference. Default:
false |
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-state | enum | The open state of the menu or submenu the element controls or belongs to. |
data-menu-content | —— | Present on the content element. |
A menu item within the dropdown menu.
Property | Type | Description |
---|---|---|
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
disabled | boolean | Whether or not the menu item is disabled. Default:
false |
href | string | An optional prop that when passed converts the dropdown item into an anchor tag. Default:
—— undefined |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-orientation | vertical | |
data-highlighted | —— | Present when the menu item is highlighted. |
data-disabled | —— | Present when the menu item is disabled. |
data-menu-item | —— | Present on the item element. |
A menu item that can be controlled and toggled like a checkbox.
Property | Type | Description |
---|---|---|
disabled | boolean | Whether or not the checkbox menu item is disabled. Disabled items cannot be interacted with and are skipped when navigating with the keyboard. Default:
false |
checked | boolean | 'indeterminate' | The checkbox menu item's checked state. Default:
false |
onCheckedChange | function | A callback that is fired when the checkbox menu item's checked state changes. Default:
—— undefined |
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-orientation | vertical | |
data-highlighted | —— | Present when the menu item is highlighted. |
data-disabled | —— | Present when the menu item is disabled. |
data-state | enum | The checkbox menu item's checked state. |
A visual indicator of the checkbox menu item's checked state. It passed the item's checked state as a slot prop checked
and can be used to render a custom indicator.
Property | Type | Description |
---|---|---|
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
attrs | object | Additional attributes to apply to the element if using the |
checked | boolean | Whether or not the checkbox is checked. |
Data Attribute | Value | Description |
---|---|---|
data-menu-checkbox-indicator | —— | Present on the checkbox indicator element. |
A group of radio menu items, where only one can be checked at a time.
Property | Type | Description |
---|---|---|
value | string | The value of the currently checked radio menu item. Default:
—— undefined |
onValueChange | function | A callback that is fired when the radio group's value changes. Default:
—— undefined |
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-menu-radio-group | —— | Present on the radio group element. |
A menu item that can be controlled and toggled like a radio button. It must be a child of a RadioGroup
.
Property | Type | Description |
---|---|---|
value * Required | string | The value of the radio item. When checked, the parent Default:
—— undefined |
disabled | false | Whether or not the radio menu item is disabled. Disabled items cannot be interacted with and are skipped when navigating with the keyboard. Default:
—— undefined |
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-orientation | vertical | |
data-highlighted | —— | Present when the menu item is highlighted. |
data-disabled | —— | Present when the menu item is disabled. |
data-state | enum | The radio menu item's checked state. |
data-value | —— | The value of the radio item. |
data-menu-radio-item | —— | Present on the radio item element. |
A visual indicator helper for RadioItem
s. It only renders it's children when the radio item is checked.
Property | Type | Description |
---|---|---|
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
attrs | object | Additional attributes to apply to the element if using the |
checked | boolean | Whether or not the checkbox is checked. |
Data Attribute | Value | Description |
---|---|---|
data-menu-radio-indicator | —— | Present on the radio indicator element. |
A horizontal line to visually separate menu items.
Property | Type | Description |
---|---|---|
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-orientation | vertical | The orientation of the separator. |
data-menu-separator | —— | Present on the separator element. |
An optional arrow which points to the dropdown menu's anchor/trigger point.
Property | Type | Description |
---|---|---|
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
size | number | The height and width of the arrow in pixels. Default:
8 |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-state | enum | The open state of the menu or submenu the element controls or belongs to. |
data-menu-arrow | —— | Present on the arrow element. |
A group of menu items. It can be used along with the Menu.Label
component to provide a visual label for a group of menu items. When a label is within a group, appropriate aria attributes will be applied to the group.
Property | Type | Description |
---|---|---|
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-menu-group | —— | Present on the group element. |
A label which will be skipped when navigating with the keyboard. It is used to provide a visual label for a group of menu items. When a label is within a Menu.Group
, appropriate aria attributes will be applied to the group.
Property | Type | Description |
---|---|---|
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-menu-label | —— | Present on the group label element. |
A submenu belonging to the parent dropdown menu. Responsible for managing the state of the submenu.
Property | Type | Description |
---|---|---|
disabled | boolean | Whether or not the submenu is disabled. Default:
—— undefined |
open | boolean | The open state of the submenu. Default:
false |
onOpenChange | function | A callback that is fired when the submenu's open state changes. Default:
—— undefined |
Slot Property | Type | Description |
---|---|---|
subIds | object | The ids of the elements within the component, useful when you don't necessarily want to provide a custom ID, but still want access to the ID being assigned (if any). |
A menu item which when pressed or hovered, opens the submenu.
Property | Type | Description |
---|---|---|
disabled | boolean | Whether or not the submenu trigger is disabled. Default:
false |
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-orientation | vertical | |
data-highlighted | —— | Present when the menu item is highlighted. |
data-disabled | —— | Present when the menu item is disabled. |
data-state | enum | The open state of the menu or submenu the element controls or belongs to. |
data-menu-subtrigger | —— | Present on the submenu trigger element. |
The submenu content displayed when the parent submenu is open.
Property | Type | Description |
---|---|---|
transition | function | A Svelte transition function to use when transitioning the content in and out. Default:
—— undefined |
transitionConfig | TransitionConfig | The configuration to apply to the transition. Default:
—— undefined |
inTransition | function | A Svelte transition function to use when transitioning the content in and out. Default:
—— undefined |
inTransitionConfig | TransitionConfig | The configuration to apply to the transition. Default:
—— undefined |
outTransition | function | A Svelte transition function to use when transitioning the content in and out. Default:
—— undefined |
outTransitionConfig | TransitionConfig | The configuration to apply to the transition. Default:
—— undefined |
side | enum | The preferred side of the anchor to render against when open. Will be reversed when collisions occur. Floating UI reference. Default:
—— undefined |
sideOffset | number | The amount of offset to apply to the menu's position on the x-axis. Floating UI reference. Default:
0 |
align | enum | The preferred alignment of the anchor to render against when open. Floating UI reference. Default:
—— undefined |
alignOffset | number | An offset in pixels from the 'start' or 'end' alignment options. Floating UI reference. Default:
0 |
avoidCollisions | boolean | When Default:
true |
collisionBoundary | union | A boundary element or array of elements to check for collisions against. Floating UI reference. Default:
—— undefined |
collisionPadding | number | The amount in pixels of virtual padding around the viewport edges to check for overflow which will cause a collision. Floating UI reference. Default:
0 |
fitViewport | boolean | Whether the floating element should be constrained to the viewport. Floating UI reference. Default:
false |
sameWidth | boolean | Whether the content should be the same width as the trigger. Floating UI reference. Default:
false |
strategy | enum | The positioning strategy to use for the floating element. Floating UI reference. Default:
absolute |
overlap | boolean | Whether the floating element can overlap the reference element. Floating UI reference. Default:
false |
asChild | boolean | Whether to use render delegation with this component or not. Default:
false |
Slot Property | Type | Description |
---|---|---|
builder | object | The builder attributes and actions to apply to the element if using the |
Data Attribute | Value | Description |
---|---|---|
data-state | enum | The open state of the menu or submenu the element controls or belongs to. |
data-menu-subcontent | —— | Present on the submenu content element. |
🚧 UNDER CONSTRUCTION 🚧