BulkBar
An inline bar at the top of the table during selection
Replaces the toolbar with the bulk action bar while rows are selected.
Counter rising while it ticks
<%!-- contador subindo enquanto marca: faixa inline do canvas, contagem animada só com CSS (mo-count, em loop) --%> <div class="flex items-center gap-2.5 rounded-lg border border-[color-mix(in_oklab,var(--lu-accent)_30%,transparent)] bg-accent-soft px-2.5 py-2"> <.checkbox id="bulk-count-check" color="primary" aria-label="Seleção" checked indeterminate /> <b class="font-semibold tabular-nums [--to:25] [--suf:'_selecionadas'] animate-[mo-count_5s_cubic-bezier(.2,.8,.2,1)_infinite] after:[counter-reset:n_var(--lu-n)] after:content-[var(--pre,'')_counter(n)_var(--suf,'')]"></b> <a href="#" class="text-[13px] font-medium text-accent-content hover:underline hover:underline-offset-[3px]">Selecionar todas as 1.096</a> <span class="min-w-0 flex-1"></span> <.button canvas size="sm"><.icon name="folder" />Mover</.button> <.button canvas size="sm"><.icon name="download" />Exportar</.button> <.button canvas size="sm" color="error"><.icon name="trash" />Excluir</.button> </div>
inline bulk_bar: count, select all and actions (Delete in danger)
<%!-- bulk_bar inline: a faixa no topo da tabela com o componente real (25 selecionadas, selecionar todas, Mover, Exportar e Excluir em danger), entrando em loop --%> <div class="rounded-xl bg-tray p-4"> <.bulk_bar id="bulk-loop" variant="inline" count={25} total={1096} label="selecionada" label_plural="selecionadas" on_select_all="select_all" select_all_label="Selecionar todas as %{total}" floating={false} class="animate-[mo-sel_6s_cubic-bezier(.2,.8,.2,1)_infinite]"> <:action icon="folder">Mover</:action> <:action icon="download">Exportar</:action> <:action variant="danger" icon="trash">Excluir</:action> </.bulk_bar> </div>
variant="float": a dark pill at the bottom center of a positioned container
<%!-- float: pílula escura no centro inferior do container posicionado (relative + altura fixa) --%> <div class="relative h-[200px] overflow-hidden rounded-xl bg-tray"> <.bulk_bar id="bulk-float-static" variant="float" count={3} label="selecionado" label_plural="selecionados" on_clear="clear" clear_label="Limpar seleção"> <:action icon="folder" title="Mover"><span class="max-sm:hidden">Mover</span></:action> <:action icon="download" title="Exportar"><span class="max-sm:hidden">Exportar</span></:action> <:action variant="danger" icon="trash" title="Excluir"><span class="max-sm:hidden">Excluir</span></:action> </.bulk_bar> </div>
Try it: select all, clear (Esc), a disabled action and delete with confirmation
<%!-- confirmação: selecionar todos, limpar (x ou Esc), ação desabilitada e Excluir com confirmação que remove as linhas --%> <.live_component module={LedgerShowcaseWeb.Demos.BulkBarDemo} id="bulk-confirm" mode={:confirm} />
Try it: a bulk action with progress and progress_max
<%!-- progresso: ação em massa com progress/progress_max (job simulado), show_esc e reset ao terminar --%> <.live_component module={LedgerShowcaseWeb.Demos.BulkBarDemo} id="bulk-progress" mode={:progress} />
Try it: interactive variant="float"
<%!-- float interativo: variant="float" em container posicionado; a ação roda na hora, sem confirmação --%> <.live_component module={LedgerShowcaseWeb.Demos.BulkBarDemo} id="bulk-float" mode={:float} />
bulk_bar floating={false}: the bar that rises when there is a selection (formerly selection_bar)
<div style="height:110px;position:relative;overflow:hidden;border-radius:14px;background:var(--lu-bg-tray)"> <div style="position:absolute;left:0;right:0;bottom:16px;display:flex;justify-content:center"> <.bulk_bar id="sel-live" count={3} label="selecionado" label_plural="selecionados" floating={false} class="animate-[mo-sel_6s_cubic-bezier(.2,.8,.2,1)_infinite]"> <:action icon="file">Emitir NF-e</:action> <:action icon="download">Exportar</:action> <:action variant="danger" icon="trash">Excluir</:action> </.bulk_bar> </div> </div>
bulk_bar variant inverse · soft · solid
<div class="flex flex-col gap-2.5"> <div :for={v <- ~w(inverse soft solid)} class="flex flex-wrap items-center gap-2.5"> <span class="font-mono text-xs text-muted" style="width:60px">{v}</span> <.bulk_bar id={"sel-" <> v} variant={v} count={3} label="selecionado" label_plural="selecionados" floating={false}> <:action icon="file">Emitir NF-e</:action> <:action icon="download">Exportar</:action> <:action variant="danger" icon="trash">Excluir</:action> </.bulk_bar> </div> </div>
Usage
<.bulk_bar count={3} total={1096} />
Rules
- Offer “select all 1,096” when the whole page is checked.
API reference
Todos os function components, atributos, valores e slots que este componente cobre.
The bar of bulk actions for a table with selection: how many are selected, optional fields,
buttons for the actions and a close that clears the selection. It shows only while count is
above zero.
<.bulk_bar
id="orders-bulk"
count={@count}
label="selecionado"
label_plural="selecionados"
total={@total}
on_select_all="select_all"
on_clear="clear_selection"
>
<:action icon="file" phx-click="issue">Emitir NF-e</:action>
<:action icon="download" phx-click="export">Exportar</:action>
<:action variant="danger" icon="trash" phx-click="delete" confirm="Excluir 3 pedidos?"
confirm_text="Os rascunhos somem para todos." confirm_label="Excluir" cancel_label="Cancelar">
Excluir
</:action>
</.bulk_bar>
Texts come from outside (label, label_plural, select_all_label with %{total},
clear_label); nothing is pluralized here.
Looks
inverse(default),softandsolid: the selection pill (dark, accent-soft and accent).-
inline: the strip at the top of a table (a panel tinted with the accent): a checkbox that clears the selection, the count, "select all" and the buttons. -
float(the canvas template's bar): a dark pill absolutely positioned at the bottom center of the closest positioned ancestor (the app shell), with the count, one:actionper button (variant="danger"is red and set apart by a rule) and the close. It ignoresfloating,progressand theconfirmof an action (the action runs at once).
floating (default) pins a pill to the bottom center of the viewport; floating={false} lays
it out where it is (a bar inside a card or a toolbar). progress/progress_max turn the bar
into a progress bar while a bulk action runs. Esc runs on_clear (phx-window-keydown).
An :action with confirm opens a small card first (above the bar when floating, below
otherwise); only its confirm button runs the action's phx-click. A disabled action keeps the
focus (aria-disabled) and renders no phx-* attributes.
Styled only with Tailwind utilities.
<.bulk_bar>
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id (required) |
:string |
||
count (required) |
:integer |
How many are selected; the bar shows only above zero. | |
label |
:string |
"selected" |
The text after the count, for one selected. |
label_plural |
:string |
nil |
|
total |
:integer |
nil |
How many there are in all (every page). |
select_all_label |
:string |
"Select all %{total}" |
|
on_clear |
:any |
nil |
|
on_select_all |
:any |
nil |
|
target |
:any |
nil |
|
clear_label |
:string |
"Clear selection" |
|
check_label |
:string |
"Selection" |
aria-label of the inline checkbox. |
show_esc |
:boolean |
false |
|
variant |
:string |
"inverse" |
inverse, soft, solid, inline, float |
floating |
:boolean |
true |
|
progress |
:integer |
nil |
|
progress_max |
:integer |
nil |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:action>- attrs:variant,disabled,icon,confirm,confirm_text,confirm_label,cancel_label,id,title,aria-label,phx-click,phx-target,phx-disable-with,phx-value-id- A button.<:field>- A control (a select, an input) in the bar.