A button that opens a menu of actions or a choice (sort by deadline, by value, by risk). The menu opens
under the button (above it when there is no room below); ↑ ↓ Home End move between items, Enter or Space
chooses, Esc closes and returns to the button, a click outside closes it (DevactionUI.Dropdown hook).
An item is a plain action (role="menuitem") or one of a group of choices (checked is not nil, then
role="menuitemradio" with a 16px ring before the label, filled on the chosen one). It sends event with
choice, or goes to navigate, patch or href. A separator puts a rule above the item, a heading
puts a small caption above it (the name of a group of choices), danger colors it as destructive and
disabled leaves it out of the keys and the clicks. Type a letter (or the first letters of a name) and the focus
jumps to the next item that starts with it. An item may begin with an icon: it takes the color of the text,
so a danger item has a red icon too.
An item sends value as choice, and values, a map, as one phx-value-* each (values={%{id: 7, kind: "task"}} arrives as "id" and "kind"). The menu closes when an item is chosen and gives the focus back
to the button; close_on_select={false} keeps it open (a menu of toggles).
The button is a bordered box by default (variant: :outline). variant: :ghost drops the border and
variant: :icon is a square with only an icon (the "more" menu of a row): give it a trigger_label, which is
its accessible name. trigger_class adds classes to the button.
Summary
Functions
One item of a menu: what dropdown/1 and DevactionUI.ContextMenu draw for each :item slot.
Functions
@spec dropdown(map()) :: Phoenix.LiveView.Rendered.t()
Attributes
id(:string) (required)label(:string) (required) - the name of the menu, for assistive technology.align(:atom) - Defaults to:start. Must be one of:start, or:end.size(:atom) - the height of the button: 38 or 42px. Defaults to:md. Must be one of:sm, or:md.variant(:atom) - Defaults to:outline. Must be one of:outline,:ghost, or:icon.trigger_label(:string) - the accessible name of the button, for one that shows only an icon. Defaults tonil.trigger_class(:any) - more classes for the button. Defaults tonil.close_on_select(:boolean) - false keeps the menu open after an item is chosen. Defaults totrue.class(:any) - Defaults tonil.target(:any) - aphx-target(a@myself) when used inside a LiveComponent. Defaults tonil.- Global attributes are accepted.
Slots
trigger(required) - what the button shows.item(required) - Accepts attributes:event(:string)value(:string) - sent aschoice.values(:map) - onephx-value-*each, besideschoice.navigate(:string)patch(:string)href(:string)checked(:boolean) - set (true or false) for a choice; leave out for an action.danger(:boolean)disabled(:boolean)separator(:boolean)heading(:string) - a caption above the item, for the group it starts.shortcut(:string)