Toolbar
A horizontal group of controls that acts as one keyboard tab stop - Tab passes over the group, Arrow keys move between its controls.
Installation
Included in poetry-ui — available as
poetry_toolbar
the moment you've installed Poetry,
with no per-component step. To own the source and edit it, copy it into your app:
bin/rails g poetry:add toolbar
Default
<%= poetry_toolbar(label: "Invoice actions") do |toolbar| %>
<% toolbar.with_button(variant: :outline, size: :sm) { "Export" } %>
<% toolbar.with_button(variant: :outline, size: :sm) { "Archive" } %>
<% toolbar.with_separator %>
<% toolbar.with_input(type: "search", placeholder: "Filter invoices…", "aria-label": "Filter invoices") %>
<% end %>
API
Poetry::Ui::Toolbar::Component — options are
constructor keywords (the poetry_* helper forwards them);
slots are composed inside the block. Generated from the gem's source documentation.
| Option | Type | Details | Description |
|---|---|---|---|
| orientation: | Symbol | one of: horizontal, vertical; defaults to :horizontal |
The strip's axis; :vertical stacks the controls and flips the arrow keys. |
| label: | String | required | The toolbar's accessible name. Required. |
| loop: | Boolean | defaults to true |
Whether arrow navigation wraps at the ends. |
Slots
| Writer | Description |
|---|---|
| with_button | The control slots: with_button (a real Button - tag: :a makes it a link), with_input (search/filter), with_separator (its orientation flips automatically). |
| with_input | The control slots: with_button (a real Button - tag: :a makes it a link), with_input (search/filter), with_separator (its orientation flips automatically). |
| with_separator | The control slots: with_button (a real Button - tag: :a makes it a link), with_input (search/filter), with_separator (its orientation flips automatically). |
Styling
Every part carries a stable data-slot attribute — target
[data-slot=…] from your own CSS to restyle it. State rides
data attributes on the parts below. This contract is verified against rendered DOM in CI.
| Part | Description |
|---|---|
| [data-slot=toolbar] | The role=toolbar root - one Tab stop; arrow keys rove across the slotted controls (roving-focus, with the caret guard protecting inputs) |
State attributes
| Part | Attribute | Condition | Values |
|---|---|---|---|
| toolbar | data-orientation | always - which arrows rove | horizontal · vertical |