Dropdown can open a menu or any other element when the button is clicked.
Class name | Type | |
---|---|---|
dropdown | Component | Dropdown container |
dropdown-content | Part | Content part |
dropdown-start | Placement | Align horizontally to start of button |
dropdown-center | Placement | Align horizontally to center of button |
dropdown-end | Placement | Align horizontally to end of button |
dropdown-top | Placement | Open from top |
dropdown-bottom | Placement | Open from bottom |
dropdown-left | Placement | Open from left |
dropdown-right | Placement | Open from right |
dropdown-hover | Modifier | Opens on hover too |
dropdown-open | Modifier | Force open |
details and summary are native HTML elements that can be used to create dropdowns.
Dropdown using details and summary opens and closes the content when the summary is clicked. You can also open/close it using JS by adding/removing the open
attribute
Container for the button + content
│
│ button to toggle the visibility of the content
│ │
<details> ──╯ │
<summary>open or close</summary> ──╯
Content
</details>
<details class="$$dropdown"> <summary class="btn m-1">open or close</summary> <ul class="$$menu $$dropdown-content bg-base-100 $$rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </details>
<details class="$$dropdown">
<summary class="btn m-1">open or close</summary>
<ul class="$$menu $$dropdown-content bg-base-100 $$rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</details>
<details class="$$dropdown"> <summary class="btn m-1">open or close</summary> <ul class="$$menu $$dropdown-content bg-base-100 $$rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </details>
<details class="$$dropdown">
<summary class="btn m-1">open or close</summary>
<ul class="$$menu $$dropdown-content bg-base-100 $$rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</details>
new
Popover API is the new HTML standard for creating dropdowns. It opens the dropdown on a top layer, which means there’s no need to z-index management and there’s no overflow issue.
Anchor positioning is a new CSS standard for positioning elements relative to an anchor.
<button
style="anchor-name:--anchor-1" ────────────────╮
popovertarget="popover-1" ───────╮ │
>Button</button> Unique ID │
│ │
<div popover │ Positions this dropdown relative to this button
id="popover-1" ──────────────────╯ │
style="position-anchor:--anchor-1" ────────────╯
>Content</div>
popovertarget
is the unique ID of the popover content.
anchor-name
/position-anchor
is the unique name of the anchor.
CSS Anchor Positioning is a new standard and is not supported in Firefox and Safari yet.
In Firefox and Safari, the dropdown will be positioned at the center of the screen, like a modal.
<!-- change popover-1 and --acnhor-1 names. Use unique names for each dropdown --> <button class="btn" popovertarget="popover-1" style="anchor-name:--anchor-1"> Button </button> <ul class="dropdown menu w-32 rounded-box bg-base-100 shadow-sm" popover id="popover-1" style="position-anchor:--anchor-1"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul>
<!-- change popover-1 and --acnhor-1 names. Use unique names for each dropdown -->
<button class="btn" popovertarget="popover-1" style="anchor-name:--anchor-1">
Button
</button>
<ul class="dropdown menu w-32 rounded-box bg-base-100 shadow-sm"
popover id="popover-1" style="position-anchor:--anchor-1">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
<!-- change popover-1 and --acnhor-1 names. Use unique names for each dropdown --> <button class="btn" popovertarget="popover-1" style="anchor-name:--anchor-1"> Button </button> <ul class="dropdown menu w-32 rounded-box bg-base-100 shadow-sm" popover id="popover-1" style="position-anchor:--anchor-1"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul>
<!-- change popover-1 and --acnhor-1 names. Use unique names for each dropdown -->
<button class="btn" popovertarget="popover-1" style="anchor-name:--anchor-1">
Button
</button>
<ul class="dropdown menu w-32 rounded-box bg-base-100 shadow-sm"
popover id="popover-1" style="position-anchor:--anchor-1">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
The content gets displayed when the button is focused.
Focusable button
│
<div> │
<div tabindex="0" role="button">Click to open</div> ─────╯
<div tabindex="0">Content</div> ───────╮
</div> │
Content shown when button is focused
Why div?
Safari has a CSS bug since 2008 that prevents button elements from being focused, so we use divtabindex="0"
as a workaround. This approach is accessible with the addition ofrole="button"
and functions consistently across all browsers.
<div class="$$dropdown $$dropdown-start"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-start">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-start"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-start">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-end"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-end">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-end"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-end">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-center"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-center">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-center"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-center">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-top"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-top">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-top"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-top">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-top $$dropdown-center"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-top $$dropdown-center">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-top $$dropdown-center"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-top $$dropdown-center">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-top $$dropdown-end"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-top $$dropdown-end">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-top $$dropdown-end"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-top $$dropdown-end">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬆️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-bottom"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-bottom">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-bottom"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-bottom">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-bottom $$dropdown-center"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-bottom $$dropdown-center">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-bottom $$dropdown-center"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-bottom $$dropdown-center">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-bottom $$dropdown-end"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-bottom $$dropdown-end">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-bottom $$dropdown-end"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-bottom $$dropdown-end">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬇️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-left"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-left">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-left"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-left">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-left $$dropdown-center"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-left $$dropdown-center">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-left $$dropdown-center"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-left $$dropdown-center">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-left $$dropdown-end"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-left $$dropdown-end">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-left $$dropdown-end"> <div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-left $$dropdown-end">
<div tabindex="0" role="button" class="$$btn m-1">Click ⬅️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-right"> <div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-right">
<div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-right"> <div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-right">
<div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-right $$dropdown-end"> <div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-right $$dropdown-end">
<div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-right $$dropdown-end"> <div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-right $$dropdown-end">
<div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-right $$dropdown-center"> <div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-right $$dropdown-center">
<div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-right $$dropdown-center"> <div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-right $$dropdown-center">
<div tabindex="0" role="button" class="$$btn m-1">Click ➡️</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-hover"> <div tabindex="0" role="button" class="$$btn m-1">Hover</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-hover">
<div tabindex="0" role="button" class="$$btn m-1">Hover</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-hover"> <div tabindex="0" role="button" class="$$btn m-1">Hover</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-hover">
<div tabindex="0" role="button" class="$$btn m-1">Hover</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-open"> <div tabindex="0" role="button" class="$$btn m-1">Button</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-open">
<div tabindex="0" role="button" class="$$btn m-1">Button</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
<div class="$$dropdown $$dropdown-open"> <div tabindex="0" role="button" class="$$btn m-1">Button</div> <ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"> <li><a>Item 1</a></li> <li><a>Item 2</a></li> </ul> </div>
<div class="$$dropdown $$dropdown-open">
<div tabindex="0" role="button" class="$$btn m-1">Button</div>
<ul tabindex="0" class="$$dropdown-content $$menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>
</div>
This is a card. You can use any element as a dropdown.
<div class="$$dropdown"> <div tabindex="0" role="button" class="$$btn m-1">Click</div> <div tabindex="0" class="$$dropdown-content $$card $$card-sm bg-base-100 z-1 w-64 shadow-md"> <div class="$$card-body"> <p>This is a card. You can use any element as a dropdown.</p> </div> </div> </div>
<div class="$$dropdown">
<div tabindex="0" role="button" class="$$btn m-1">Click</div>
<div
tabindex="0"
class="$$dropdown-content $$card $$card-sm bg-base-100 z-1 w-64 shadow-md">
<div class="$$card-body">
<p>This is a card. You can use any element as a dropdown.</p>
</div>
</div>
</div>
<div class="$$dropdown"> <div tabindex="0" role="button" class="$$btn m-1">Click</div> <div tabindex="0" class="$$dropdown-content $$card $$card-sm bg-base-100 z-1 w-64 shadow-md"> <div class="$$card-body"> <p>This is a card. You can use any element as a dropdown.</p> </div> </div> </div>
<div class="$$dropdown">
<div tabindex="0" role="button" class="$$btn m-1">Click</div>
<div
tabindex="0"
class="$$dropdown-content $$card $$card-sm bg-base-100 z-1 w-64 shadow-md">
<div class="$$card-body">
<p>This is a card. You can use any element as a dropdown.</p>
</div>
</div>
</div>
Here is a description!
A normal text and a helper dropdown <div class="$$dropdown $$dropdown-end"> <div tabindex="0" role="button" class="$$btn $$btn-circle $$btn-ghost $$btn-xs text-info"> <svg tabindex="0" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="h-4 w-4 stroke-current"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path> </svg> </div> <div tabindex="0" class="$$card $$card-sm $$dropdown-content bg-base-100 rounded-box z-1 w-64 shadow-sm"> <div tabindex="0" class="$$card-body"> <h2 class="$$card-title">You needed more info?</h2> <p>Here is a description!</p> </div> </div> </div>
A normal text and a helper dropdown
<div class="$$dropdown $$dropdown-end">
<div tabindex="0" role="button" class="$$btn $$btn-circle $$btn-ghost $$btn-xs text-info">
<svg
tabindex="0"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
class="h-4 w-4 stroke-current">
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</div>
<div
tabindex="0"
class="$$card $$card-sm $$dropdown-content bg-base-100 rounded-box z-1 w-64 shadow-sm">
<div tabindex="0" class="$$card-body">
<h2 class="$$card-title">You needed more info?</h2>
<p>Here is a description!</p>
</div>
</div>
</div>
A normal text and a helper dropdown <div class="$$dropdown $$dropdown-end"> <div tabindex="0" role="button" class="$$btn $$btn-circle $$btn-ghost $$btn-xs text-info"> <svg tabindex="0" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="h-4 w-4 stroke-current"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path> </svg> </div> <div tabindex="0" class="$$card $$card-sm $$dropdown-content bg-base-100 rounded-box z-1 w-64 shadow-sm"> <div tabindex="0" class="$$card-body"> <h2 class="$$card-title">You needed more info?</h2> <p>Here is a description!</p> </div> </div> </div>
A normal text and a helper dropdown
<div class="$$dropdown $$dropdown-end">
<div tabindex="0" role="button" class="$$btn $$btn-circle $$btn-ghost $$btn-xs text-info">
<svg
tabindex="0"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
class="h-4 w-4 stroke-current">
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</div>
<div
tabindex="0"
class="$$card $$card-sm $$dropdown-content bg-base-100 rounded-box z-1 w-64 shadow-sm">
<div tabindex="0" class="$$card-body">
<h2 class="$$card-title">You needed more info?</h2>
<p>Here is a description!</p>
</div>
</div>
</div>