Skip to content

Dropdown

A Bootstrap dropdown: a toggle and a menu of items, built from sub-components. It needs tabler.js.

The toggle is a <button type="button">, so it never submits an enclosing form. Without variant, it is a plain .btn. noCaret hides the caret, for an icon-only toggle:

split makes the toggle the caret-only half of a split button: put it after a Button in a ButtonGroup, followed by the menu. Give it an aria-label:

end aligns the menu with the end of the toggle, for a toggle on the right of the page:

direction sets where the menu opens: up (dropup), end (dropend) or start (dropstart). The menu flips to the other side when there is no room:

Dropdowns do not nest into submenus: Dropdown:Toggle is a button (.btn), not the .dropdown-item a submenu trigger needs.

arrow adds a small arrow pointing at the toggle, dark a dark menu on a light page, and scrollable caps the menu height and scrolls the rest:

card turns the menu into a panel for rich content: put a Card in it.

Dropdown:Columns splits a long menu into Dropdown:Columns. Dropdown:Text is plain text that is not an action:

active highlights an item, disabled makes it non-interactive. icon puts a Tabler icon before the label, with the dropdown-item-icon class:

Dropdown:Indicator is a leading slot in an item for a small marker, such as an avatar, a checkbox or a flag (dropdown-item-indicator):

An item holding a checkbox or a radio cannot be a link: set tag="label" on it, so a click anywhere on the item toggles the input. tag also takes button, for an action that is not a navigation. Add data-bs-auto-close="outside" to the toggle to keep the menu open while the user ticks several options:

Component Renders
Dropdown <div class="dropdown"> around the toggle and the menu
Dropdown:Toggle <button type="button" class="btn dropdown-toggle" data-bs-toggle="dropdown">
Dropdown:Menu <div class="dropdown-menu">
Dropdown:Item <a class="dropdown-item">, or the element set by tag
Dropdown:Header <div class="dropdown-header">: a non-interactive label above a group of items
Dropdown:Text <span class="dropdown-item-text">: plain text that is not an action
Dropdown:Indicator <span class="dropdown-item-indicator">: a leading avatar, checkbox or flag in an item
Dropdown:Divider <div class="dropdown-divider">: a separator between groups of items
Dropdown:Columns <div class="dropdown-menu-columns">: splits the menu into columns
Dropdown:Column <div class="dropdown-menu-column">: one column of Dropdown:Columns

Attributes of each component go to its root element.

Dropdown:Header, Dropdown:Text, Dropdown:Indicator, Dropdown:Divider, Dropdown:Columns and Dropdown:Column take no props.

Prop Type Default Description
direction string 'down' down up end start: where the menu opens (dropup dropend dropstart)
Prop Type Default Description
variant string? null primary secondary success danger warning info dark light; null for a plain .btn
noCaret bool false Hides the caret (no dropdown-toggle class)
split bool false Caret-only half of a split button (dropdown-toggle-split)
Prop Type Default Description
end bool false Aligns the menu to the end (dropdown-menu-end)
arrow bool false Arrow pointing at the toggle (dropdown-menu-arrow)
dark bool false Dark menu (dropdown-menu-dark)
scrollable bool false Caps the height and scrolls (dropdown-menu-scrollable)
card bool false Panel for rich content (dropdown-menu-card)
Prop Type Default Description
tag string 'a' a button label… Only an <a> gets the href; a button gets type="button"
href string? null Link target, # when null
active bool false Highlighted item (active)
disabled bool false Non-interactive item (disabled, aria-disabled, or the disabled attribute on a button)
icon string? null Leading Tabler icon name (dropdown-item-icon)