FleetbaseFleetbase

DropdownButton

<DropdownButton> is a button that opens a dropdown menu — used for action menus, bulk actions, and grouped controls. Accepts an items array or yields a custom dropdown body.

<DropdownButton>

A button that opens a dropdown panel on click. Used for action menus ("More…"), grouped controls (bulk actions), and any UI where a primary trigger reveals a list of choices.

Items-Based Usage

<DropdownButton @text="Actions" @icon="ellipsis" @items={{this.actions}} />
actions = [
  { text: 'Edit',   icon: 'pencil',  onClick: this.edit },
  { text: 'Export', icon: 'download', onClick: this.exportData },
  { separator: true },
  { text: 'Delete', icon: 'trash',    onClick: this.delete, class: 'text-red-500' },
];

Each item supports:

FieldDescription
text (or label)Menu item label
iconFontAwesome icon
iconSize, iconWidthIcon overrides
onClick (or fn)Click handler
performEmber-concurrency task to perform
disabledDisabled state
classExtra classes on the item
wrapperClassExtra classes on the wrapper
separator: trueRender a separator instead of an item
seperatorClassExtra classes on the separator

Block-Based Usage

For richer dropdown content, yield a block. The yield is the BasicDropdown API — you can call dd.actions.close() from inside:

<DropdownButton @text="Filters" @icon="filter" as |dd|>
  <div class="next-dd-menu p-4 w-72">
    <h3 class="font-semibold mb-2">Filter by status</h3>
    {{!-- ... --}}
    <Button @text="Apply" @onClick={{dd.actions.close}} />
  </div>
</DropdownButton>

Arguments

Button

ArgumentTypeDefaultDescription
@textstringButton label
@iconstringFontAwesome icon
@iconPrefix, @iconSize, @iconClassIcon overrides
@typestringdefaultButton type — primary, magic, etc.
@sizestringxs, sm, md, lg, xl
@activebooleanForce the active state
@isLoadingbooleanShow a spinner
@disabledbooleanDisable the button
@visiblebooleantrueWhen false, nothing renders
@helpTextstringTooltip on the button
@tooltipPlacementstringtopTooltip placement
@buttonClass, @buttonWrapperClass, @textClassClass overrides
@buttonComponentstringReplace the default <Button> with a custom component
@buttonComponentArgsobjectArgs forwarded to @buttonComponent
@img, @imgClass, @altRender an image inside the button
@permissionstringPermission gating
ArgumentTypeDefaultDescription
@itemsarrayItem descriptors (when not using a block)
@dropdownIdstringDOM id for the dropdown
@triggerClass, @contentClass, @dropdownMenuClassClass overrides
@horizontalPositionstringleft, right, auto
@verticalPositionstringabove, below, auto
@matchTriggerWidthbooleanMake the panel as wide as the trigger
@calculatePositionfunctionCustom positioning function
@renderInPlacebooleanRender in DOM order vs. portal
@overlaybooleanRender a backdrop behind the panel
@defaultClassstringClass on the dropdown's default state
@onOpen, @onClosefunctionsLifecycle callbacks

Real-World Examples

{{!-- Action menu on a row --}}
<DropdownButton @icon="ellipsis" @size="xs" @items={{this.rowActions}} />

{{!-- Bulk actions menu (only visible when rows are selected) --}}
{{#if this.selectedCount}}
  <DropdownButton
    @icon="layer-group"
    @text="Bulk Actions"
    @type="magic"
    @items={{this.bulkActions}}
  />
{{/if}}

{{!-- Block-based filter panel --}}
<DropdownButton @text="Filters" @icon="filter" as |dd|>
  <div class="p-4">
    <FiltersPanel @onApply={{fn this.applyFilters dd}} />
  </div>
</DropdownButton>

Source

DropdownButton | Fleetbase