Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/decorators/display.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ The following example illustrates how to implement a dropdown menu with a list o
- `title` - The text label for the menu item
- `link` (optional) - A URL or path that the item will link to when clicked
- `striped` (optional) - When set to true, adds alternating background colors to list items for better visual separation
- `height` (optional) - Sets a maximum height in pixels, after which the content becomes scrollable
- `height` (optional) - Sets height in pixels for the dropdown menu
- `max_height` (optional) - Sets a maximum height in pixels, after which the content becomes scrollable
- `width` (optional) - Defines the dropdown's width in pixels for precise layout control

The dropdown menu automatically positions itself below the trigger element and includes built-in behavior to close when clicking outside the menu or selecting an item.
Expand Down
2 changes: 1 addition & 1 deletion src/unfold/templates/unfold/helpers/display_dropdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{{ value.content }}
</div>
{% else %}
<nav class="bg-white border border-base-200 overflow-y-auto overflow-x-hidden flex flex-col py-1 rounded-default shadow-lg text-sm top-7 z-50 w-48 dark:bg-base-800 dark:border-base-700" data-simplebar x-cloak x-transition x-anchor.bottom-start.offset.4="$refs.rowDropdown{{ dropdown_id }}" x-show="openDropdownId{{ dropdown_id }}"x-on:click.outside="openDropdownId{{ dropdown_id }} = false" {% if value.width or value.height %}style="{% if value.width %}width: {{ value.width }}px;{% endif %}{% if value.height %}height: {{ value.height }}px;{% endif %}"{% endif %}>
<nav class="bg-white border border-base-200 overflow-y-auto overflow-x-hidden flex flex-col py-1 rounded-default shadow-lg text-sm top-7 z-50 w-48 dark:bg-base-800 dark:border-base-700" data-simplebar x-cloak x-transition x-anchor.bottom-start.offset.4="$refs.rowDropdown{{ dropdown_id }}" x-show="openDropdownId{{ dropdown_id }}"x-on:click.outside="openDropdownId{{ dropdown_id }} = false" {% if value.width or value.height %}style="{% if value.width %}width: {{ value.width }}px;{% endif %}{% if value.height %}height: {{ value.height }}px;{% endif %} {% if value.max_height %}max-height: {{ value.max_height }}px;{% endif %}"{% endif %}>
{% for item in value.items %}
<{% if item.link %}a{% else %}span{% endif %} {% if item.link %}href="{{ item.link }}"{% endif %} class="flex items-center gap-2 mx-1 px-3 py-2 max-h-[30px] rounded-default hover:bg-base-100 dark:hover:bg-base-700 dark:hover:text-base-200 {% if value.striped %}{% cycle '' 'bg-base-50 dark:bg-white/[.04]' %}{% endif %}">
<span class="grow truncate">{{ item.title }}</span>
Expand Down