- ☀️Light
- 🌙Dark
- 💻System
💠 Examples
💻 HTML Code
🧩 How to use
Add data-js="dropdown" to the button and set
data-target to the menu ID.
The script opens or closes the dropdown and updates
aria-expanded automatically.
📍 Positioning
Add position classes directly on the .dropdown-menu to control where it appears.
If no position class is added, the menu defaults to
.bottom and
.left.
You can also use breakpoint‑based classes to change the dropdown position depending on the screen size.
.left
.left-{breakpoint}.center
.center-{breakpoint}.right
.right-{breakpoint}.top
.top-{breakpoint}.bottom
.bottom-{breakpoint}.side-left
.side-left-{breakpoint}.side-right
.side-right-{breakpoint}🎨 Sizes & Colors
Dropdown buttons use the same size and color classes as regular buttons.
Refer to the Button page for all available variants.
📌 Accessibility
For accessibility, set aria-expanded on the button only once to match the initial state.
After that, the script updates its value automatically when the dropdown opens or closes.
Add aria-controls to link the button to the menu ID.
This helps assistive technologies understand which element is being toggled.
⚙️ Variables CSS
| Variable | Description |
|---|---|
--dropdown-body-box-shadow |
Shadow applied to the dropdown body. |
--dropdown-body-min-width |
Minimum width of the dropdown body. |
--dropdown-body-spacing-margin |
Margin used to create spacing around the dropdown body. |