Selection bar
A dark bar that floats up from the bottom while items in a list are selected, holding the count and the actions for all of them. It leaves when the selection is empty.
Usage
Use it when
- Bulk actions on a list or table people select from: archive 12 messages, grade 5 submissions, export 30 students.
- Selection mode on phones, where a toolbar at the top would be out of reach.
Use something else when
- Actions on a single item: use Dropdown menu. Use the item's "more" menu.
- Confirming that a bulk action happened: use Toast.
- Persistent page actions that do not depend on a selection: use Page header.
- Saving a form: use Form layout. The form ends with its own actions.
Where it goes. Fixed at the bottom center of the window, 20 px from the bottom (more on phones with a home indicator), above the content and below dialogs. One per page. On a phone with a tab bar, lift it above the bar.
Examples
<div class="selbar" role="toolbar" aria-label="Selected submissions"> <span class="selbar__count" aria-live="polite">3 selected</span> <button class="btn btn--md"><span class="ic" aria-hidden="true">edit</span>Grade</button> <button class="btn btn--md"><span class="ic" aria-hidden="true">download</span>Export</button> <button class="icon-btn" aria-label="Clear selection"><span class="ic" aria-hidden="true">close</span></button> </div> <!-- add .is-open while one or more items are selected -->
btn--danger appears outside a confirm, because it opens an alert dialog or deletes with an Undo toast.<div class="selbar is-open" role="toolbar" aria-label="Selected messages"> <span class="selbar__count">12 selected</span> <button class="btn btn--md"><span class="ic" aria-hidden="true">inventory_2</span>Archive</button> <button class="btn btn--md btn--danger"><span class="ic" aria-hidden="true">delete</span>Delete</button> <button class="icon-btn" aria-label="Clear selection"><span class="ic" aria-hidden="true">close</span></button> </div>
Anatomy
| Part | What it is |
|---|---|
.selbar[role=toolbar] | Required. The floating bar: inverse colors, 52 px tall, 16 px radius. aria-label it. |
.selbar__count | Required. "3 selected", tabular figures. Put it in a live region so changes are announced. |
.btn | The bulk actions, restyled for the inverse bar (38 px, quiet fill). btn--danger for a destructive one. |
.icon-btn | Clear selection, last, with aria-label. |
.selbar__label | Optional. Wrap a button's words in it (and give the button an aria-label) so under 520 px the bar keeps only the icons and fits the phone. |
.roll | Optional, inside the count: the number rolls as the selection changes (the selection hook sets it). |
States
| State | How |
|---|---|
.is-open | Visible and interactive while at least one item is selected. |
closed | Transparent, 16 px lower and 2 % smaller, visibility: hidden after the exit. |
Motion and microinteractions
- Enter: opacity over
--d-fast(160 ms) on--ease-enter; rises fromtranslateY(16px) scale(0.98)on--spring-smoothover--d-smooth. - Exit: over
--d-exit(180 ms) on--ease-exit, then hidden. Selecting again mid-exit reverses it, since it is a transition. - The count changes in place; pair it with rolling number for large counts if you like. Reduced motion: no rise, 120 ms fade.
Accessibility
role="toolbar"with anaria-labelnaming what is selected.- The count sits in an
aria-live="polite"region so "3 selected" is announced as it changes. - Make it
inert(or remove it) while closed so hidden buttons are not tabbable. Clearing the selection should return focus to the list. - Every item checkbox has its own label ("Select Rina Wijaya").
Do and don't
Do
- Keep two or three actions plus clear.
- Confirm the result with a toast and Undo where possible.
Don't
- Show the bar when nothing is selected.
- Put single-item actions or navigation in it.
- Stack it with a second floating bar.
Behavior and code
Plain HTML. data-lds-selection="barId" on the list, table or grid that holds input[data-lds-select] checkboxes (and an optional input[data-lds-select-all]) opens and closes the bar, rolls a .roll inside .selbar__count, keeps the bar inert while closed, ticks a run on Shift-click and clears on Escape or [data-lds-select-clear]; see data table and file tile. Without the hook, toggle .is-open from your selection state and update the count. The bar uses position: fixed, so inside a transformed container it pins to that container instead (as in this demo).