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
@textstring—Button label
@iconstring—FontAwesome icon
@iconPrefix, @iconSize, @iconClass——Icon overrides
@typestringdefaultButton type — primary, magic, etc.
@sizestring—xs, sm, md, lg, xl
@activeboolean—Force the active state
@isLoadingboolean—Show a spinner
@disabledboolean—Disable the button
@visiblebooleantrueWhen false, nothing renders
@helpTextstring—Tooltip on the button
@tooltipPlacementstringtopTooltip placement
@buttonClass, @buttonWrapperClass, @textClass——Class overrides
@buttonComponentstring—Replace the default <Button> with a custom component
@buttonComponentArgsobject—Args forwarded to @buttonComponent
@img, @imgClass, @alt——Render an image inside the button
@permissionstring—Permission gating
ArgumentTypeDefaultDescription
@itemsarray—Item descriptors (when not using a block)
@dropdownIdstring—DOM id for the dropdown
@triggerClass, @contentClass, @dropdownMenuClass——Class overrides
@horizontalPositionstring—left, right, auto
@verticalPositionstring—above, below, auto
@matchTriggerWidthboolean—Make the panel as wide as the trigger
@calculatePositionfunction—Custom positioning function
@renderInPlaceboolean—Render in DOM order vs. portal
@overlayboolean—Render a backdrop behind the panel
@defaultClassstring—Class on the dropdown's default state
@onOpen, @onClosefunctions—Lifecycle 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