Menu
DMenu renders the menu list. DMenuItem handles
links, buttons, active and disabled states; DMenuTitle adds section titles.
Nested
Basic
<DMenu Class="bg-base-200 w-56">
<DMenuItem Href="components/buttons" Active="@(_selected == "buttons")"
@onclick='() => _selected = "buttons"'>Buttons</DMenuItem>
<DMenuItem Href="components/badges" Active="@(_selected == "badges")"
@onclick='() => _selected = "badges"'>Badges</DMenuItem>
<DMenuItem Disabled="true">Sold out</DMenuItem>
</DMenu>
@code {
private string? _selected = "buttons";
}With title and submenu
<DMenu Class="bg-base-200 w-56">
<DMenuTitle>Components</DMenuTitle>
<DMenuItem Href="components/forms">Forms</DMenuItem>
<li>
<details open>
<summary>Overlays</summary>
<ul>
<DMenuItem Href="components/modal">Modal</DMenuItem>
<DMenuItem Href="components/tooltip">Tooltip</DMenuItem>
</ul>
</details>
</li>
</DMenu>With icons— Built-in glyph, CDN glyph (Iconify) and a larger icon
<DMenu Class="bg-base-200 w-56">
<DMenuItem Href="/" Icon="@DaisyIcon.FromUrl("home", "https://api.iconify.design/lucide/home.svg")">Home</DMenuItem>
<DMenuItem Href="components/forms" Icon="@DaisyIcons.Search">Search form</DMenuItem>
<DMenuItem Icon="@DaisyIcons.Trash" IconSize="DaisySize.Medium" OnClick="@(() => { })">Delete draft</DMenuItem>
</DMenu>Horizontal
<DMenu Orientation="DaisyOrientation.Horizontal" Class="bg-base-200 rounded-box">
<DMenuItem Href="/">Home</DMenuItem>
<DMenuItem Href="components/menu">Menu</DMenuItem>
<DMenuItem Href="components/steps">Steps</DMenuItem>
<DMenuItem Disabled="true">Coming soon</DMenuItem>
</DMenu>Sizes— menu-xs to menu-lg
@foreach (var size in new[] { DaisySize.ExtraSmall, DaisySize.Small, DaisySize.Large })
{
<DMenu Size="@size" Class="bg-base-200 w-44">
<DMenuItem Href="#">Item @(size)</DMenuItem>
<DMenuItem Href="#">Another item</DMenuItem>
</DMenu>
}API
DMenu
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Orientation | DaisyOrientation | Auto | — | Vertical (default daisy behavior) or horizontal menu bar. Auto emits no class. AutoVerticalHorizontal |
| Size | DaisySize | Medium | — | Menu size ( menu-xs ... menu-lg ). ExtraSmallSmallMediumLargeExtraLarge |
| ChildContent | RenderFragment | — | — | Menu items: standard li markup, DMenuItem or DMenuTitle children. Nested ul s and details/summary submenus work as in plain daisyUI. |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |
DMenuItem
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| Href | string | — | — | Optional link target; renders an anchor when set, a button otherwise. |
| Active | bool | False | — | Marks the item as the active page ( menu-active + aria-current ). |
| Disabled | bool | False | — | Marks the item as disabled ( menu-disabled ). |
| Icon | DaisyIcon | — | — | Optional leading icon (e.g. DaisyIcons.Bars or a CDN icon via DaisyIcon.FromUrl ). |
| IconSize | DaisySize | Small | — | Icon size for Icon . ExtraSmallSmallMediumLargeExtraLarge |
| ChildContent | RenderFragment | — | — | The item content. |
| OnClick | EventCallback<MouseEventArgs> | — | — | Click handler (not invoked when Disabled ). |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |
DMenuTitle
Parameters
| Name | Type | Default | Binding | Description |
|---|---|---|---|---|
| ChildContent | RenderFragment | — | — | The title text/markup. |
| Class | string | — | — | Additional CSS classes appended to the component's computed daisyUI classes. |
| Style | string | — | — | Inline styles applied to the root element. |