Dock
A floating bar of primary destinations and quick actions at the bottom of a phone screen.
Usage
After the one-time setup, call the helper directly from ERB. No component import is needed.
<%# The transformed frame holds the dock's fixed parts for this preview; in an app they sit on the screen. %>
<div class="relative h-80 w-full max-w-sm overflow-hidden rounded-3xl bg-background transform-gpu">
<%= lc_dock do |dock| %>
<%= dock.nav label: "Sections" do |nav| %>
<%= nav.link "Home", "#", icon: "home", current: true %>
<%= nav.link "Notes", "#", icon: "document-text" %>
<%= nav.link "People", "#", icon: "users" %>
<% end %>
<%= dock.menu label: "Create", id: "dock-specimen-menu" do |menu| %>
<%= menu.action "New note", icon: "pencil-square" %>
<%= menu.action "New project", icon: "rectangle-stack" %>
<% end %>
<% end %>
</div>
Examples
Dock with actions
<%# The transformed frame holds the dock's fixed parts for this preview; in an app they sit on the screen. %>
<div class="relative h-80 w-full max-w-sm overflow-hidden rounded-3xl bg-background transform-gpu">
<%= lc_dock do |dock| %>
<%= dock.nav label: "Sections" do |nav| %>
<%= nav.link "Home", "#", icon: "home", current: true %>
<%= nav.link "Notes", "#", icon: "document-text" %>
<%= nav.link "People", "#", icon: "users" %>
<% end %>
<%= dock.menu label: "Create", id: "dock-specimen-menu" do |menu| %>
<%= menu.action "New note", icon: "pencil-square" %>
<%= menu.action "New project", icon: "rectangle-stack" %>
<% end %>
<% end %>
</div>
API reference
Helpers render semantic HTML and include their interaction wiring. Pass native attributes through class:, data:, aria: and the usual Rails options. Blocks use captured ERB content.
lc_dock
lc_dock(**attributes, &block)
| Input | Default | Values |
|---|---|---|
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
lc_dock yields a builder, dock, with these parts. Each part carries data-slot and merges class: and native attributes.
dock.nav
| Input | Default | Values |
|---|---|---|
| label | Required | Accessible name, visible where applicable |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
dock.menu
| Input | Default | Values |
|---|---|---|
| label | Required | Accessible name, visible where applicable |
| icon | "plus" | Heroicon name; spacing is handled automatically |
| id | nil | — |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
menu.action
| Input | Default | Values |
|---|---|---|
| label | Required | Accessible name, visible where applicable |
| icon | Required | Heroicon name; spacing is handled automatically |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
Styling and extension
Use class: to merge utilities, native attributes for application behavior, and the theming guide for the shared palette. For custom markup, the advanced class helpers expose the same styles, including glass surfaces and class merging.