Dropdown
An interactive Dropdown component for discoverable content.
How it works #
The Dropdown component displays a menu of actions or links that appears when triggered, providing a compact way to present options to users.
How to use:
This demo shows the essential structure for a dropdown menu and how to organize its content for user interaction.
How to use:
- Add the
Dropdowncomponent to your page. - Place your trigger element (such as a button) inside
<DropdownTrigger>. - Define the dropdown menu items inside
<DropdownContent>usingDropdownLinkItemfor links andDropdownDividerfor separators. - Use the
IsActiveparameter on aDropdownLinkItemto highlight the active item if needed.
<Dropdown>
<DropdownTrigger>
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
<span>Dropdown button</span>
<span class="icon is-small">
<i class="bi bi-chevron-down" aria-hidden="true"></i>
</span>
</button>
</DropdownTrigger>
<DropdownContent>
<DropdownLinkItem Href="#"> Dropdown item </DropdownLinkItem>
<DropdownLinkItem Href="#"> Other dropdown item </DropdownLinkItem>
<DropdownLinkItem Href="#" IsActive="true"> Active dropdown item </DropdownLinkItem>
<DropdownLinkItem Href="#"> Other dropdown item </DropdownLinkItem>
<DropdownDivider />
<DropdownLinkItem Href="#"> With a divider </DropdownLinkItem>
</DropdownContent>
</Dropdown>Dropdown content #
The Dropdown menu supports any type of content, not just links, allowing for flexible layouts and custom markup.
How to use:
This demo illustrates how to combine different content types within a dropdown for advanced scenarios.
How to use:
- Place any markup (such as paragraphs, divs, or custom components) inside
<DropdownContent>. - Use
DropdownItemfor custom content andDropdownLinkItemfor navigational links. - Insert
DropdownDividerto visually separate groups of items.
<Dropdown>
<DropdownTrigger>
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
<span>Dropdown button</span>
<span class="icon is-small">
<i class="bi bi-chevron-down" aria-hidden="true"></i>
</span>
</button>
</DropdownTrigger>
<DropdownContent>
<DropdownItem>
<p>
You can insert <strong>any type of content</strong> within the
dropdown menu.
</p>
</DropdownItem>
<DropdownDivider />
<DropdownItem>
<p>You simply need to use a <code><div></code> instead.</p>
</DropdownItem>
<DropdownDivider />
<DropdownLinkItem Href="#"> This is a link item </DropdownLinkItem>
</DropdownContent>
</Dropdown>Hoverable #
The Hoverable Dropdown opens automatically when the user hovers over the trigger, offering a seamless and interactive experience.
How to use:
This demo demonstrates how to enable hover-based activation for dropdown menus.
How to use:
- Add the
Dropdowncomponent and setIsHoverable="true". - Place your trigger element inside
<DropdownTrigger>and menu items inside<DropdownContent>. - The dropdown will open on mouse hover without requiring a click.
<Dropdown IsHoverable="true">
<DropdownTrigger>
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
<span>Dropdown button</span>
<span class="icon is-small">
<i class="bi bi-chevron-down" aria-hidden="true"></i>
</span>
</button>
</DropdownTrigger>
<DropdownContent>
<DropdownItem>
<p>
You can insert <strong>any type of content</strong> within the
dropdown menu.
</p>
</DropdownItem>
</DropdownContent>
</Dropdown>Right aligned #
The Right-aligned Dropdown positions the dropdown menu to the right edge of the trigger, useful for aligning menus in toolbars or layouts.
How to use:
This demo shows how to control the alignment of dropdown menus for different UI needs.
How to use:
- Add the
Dropdowncomponent and setIsRight="true"to align the menu to the right. - Place your trigger and menu items as usual.
- By default, dropdowns are left-aligned; use
IsRightfor right alignment.
<Dropdown>
<DropdownTrigger>
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
<span>Left aligned</span>
<span class="icon is-small">
<i class="bi bi-chevron-down" aria-hidden="true"></i>
</span>
</button>
</DropdownTrigger>
<DropdownContent>
<DropdownItem>
<p>The dropdown is <strong>left-aligned</strong> by default.</p>
</DropdownItem>
</DropdownContent>
</Dropdown>
<Dropdown IsRight="true">
<DropdownTrigger>
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
<span>Right aligned</span>
<span class="icon is-small">
<i class="bi bi-chevron-down" aria-hidden="true"></i>
</span>
</button>
</DropdownTrigger>
<DropdownContent>
<DropdownItem>
<p>
Add the <code>is-right</code> modifier for a
<strong>right-aligned</strong> dropdown.
</p>
</DropdownItem>
</DropdownContent>
</Dropdown>Dropup #
The Dropup variant displays the dropdown menu above the trigger, ideal for use near the bottom of the viewport.
How to use:
This demo demonstrates how to create a dropup menu for improved usability in certain layouts.
How to use:
- Add the
Dropdowncomponent and setIsUp="true". - Place your trigger and menu items as usual.
- The dropdown menu will appear above the trigger button.
<Dropdown IsUp="true">
<DropdownTrigger>
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
<span>Dropup button</span>
<span class="icon is-small">
<i class="bi bi-chevron-up" aria-hidden="true"></i>
</span>
</button>
</DropdownTrigger>
<DropdownContent>
<DropdownItem>
<p>
You can add the <code>is-up</code> modifier to have a dropdown menu
that appears above the dropdown button.
</p>
</DropdownItem>
</DropdownContent>
</Dropdown>Icon only #
The Icon-only Dropdown uses an icon as the trigger, providing a compact and modern way to access menu actions.
How to use:
This demo shows how to implement a dropdown menu triggered by an icon for streamlined interfaces.
How to use:
- Add the
Dropdowncomponent and setIsRight="true"if you want right alignment. - Place an icon component (such as
BootstrapIcon) inside<DropdownTrigger>to use it as the clickable element. - Define your menu items inside
<DropdownContent>as usual.
<div style="justify-self: self-end;">
<Dropdown IsRight="true">
<DropdownTrigger>
<BootstrapIcon Name="BootstrapIconName.ThreeDotsVertical" role="button" />
</DropdownTrigger>
<DropdownContent>
<DropdownLinkItem Href="#"> Overview </DropdownLinkItem>
<DropdownLinkItem Href="#"> Block </DropdownLinkItem>
<DropdownLinkItem Href="#"> Box </DropdownLinkItem>
<DropdownLinkItem Href="#"> Progress Bar </DropdownLinkItem>
<DropdownLinkItem Href="#"> Pdf Viewer </DropdownLinkItem>
<DropdownLinkItem Href="#"> Bootstrap Icons </DropdownLinkItem>
<DropdownLinkItem Href="#"> Google Maps </DropdownLinkItem>
</DropdownContent>
</Dropdown>
</div>