Esc

Components

All components Every component, with search. Accordion Sections that expand and collapse, one at a time or several. Alert A highlighted message, optionally dismissible. Avatar A person's picture, with initials when there is none. Avatar group Overlapping avatars with a "+N" count for the rest. Badge A small status label. Banner A dismissible strip across the top of a page. Breadcrumb The path to the current page, collapsing long trails. Button Buttons in every variant and size, with icons and a loading state. Button to A button that submits a one-off form, like Rails' button_to. Card A bordered container with header, content and footer. Checkbox A checkbox with label, standalone or bound to a form builder. Collapsible A section that opens and closes under its trigger, like a branch of a nav tree. Confirm dialog A styled dialog that answers data-turbo-confirm, in place of the browser's confirm box. Data grid A sortable, filterable, server-paged table on AG Grid. Date picker A typed date field with a calendar, on Cally. Dialog A modal dialog on the native <dialog> element. Divider A horizontal or vertical rule, optionally labelled. Empty state What a page shows when it has nothing to list yet, with a way to add the first thing. File field A drag-and-drop file picker with a label, hint and error message, standalone or with a form builder. Form field A label, hint and error message wired to any form control. Icon An SVG icon from your chosen icon library, drawn inline on the server. Image An image with consistent sizing and corner radius. Input A text field with label, hint and error message, standalone or with a form builder. Input group A text field with addons before or after it. Label A form label with a required marker. Link A link styled as text or as a button. Menu A dropdown menu with keyboard navigation. Navigation menu Site navigation with links and hover or click panels of rich links. Pagination Page links for a long list, from a Pagy object. Password input A password field with a show/hide toggle. Popover Floating content anchored to a trigger. Radio group A set of radio buttons. Native select The browser's own select, styled closed; best for phones' system pickers. Select A styled dropdown with keyboard navigation and type-ahead, posting like a native select. Session tabs Browser-style tabs the user opens, renames, duplicates, reorders and closes. Sheet A panel that slides in from an edge of the screen. Sidebar A collapsible application sidebar with groups and menus. Skeleton A pulsing placeholder shown in a piece of content's shape while it loads. Spinner A loading indicator. Stepper The steps of a multi-step form, each one done, current or still to come. Switch An on/off toggle. Table A styled table with header, rows and caption. Table of contents An "On this page" list that follows the reader's scroll. Tabs Tabbed panels with keyboard navigation. Text Body text in set sizes, weights and tones. Textarea A multi-line text field with label, hint and error, that can grow with its text. Theme toggle A light/dark/system theme switcher. Toast A stacked, auto-dismissing message, pushed from the client or a Turbo Stream. Toggle group A row of buttons where one or several are chosen, posting like radios or checkboxes. Tooltip A hint shown on hover and focus. Typography Headings, lead, muted, code and blockquote text styles.

Stepper

UI::Stepper

The steps of a multi-step form, each one done, current or still to come.

bin/rails generate velvetkit:add stepper
Also adds
Icon
Stimulus
ui--stepper
Installs
Nothing

Live demo

Talks to a server

Each Continue posts the step to this site, which checks it and sends back the next one, or the same one with its errors. Try ada@example.com, which already has an account, or the workspace address acme, which is taken.

At least 8 characters

Examples

Horizontal

Price calculator

All printing includes full colour on both sides.

Centered, with Descriptions

Dots

Vertical

With an Error

Without Lines

Set up your store

2 of 4 done

Wizard, Checked in the Browser

acme.app/

Lowercase letters, numbers and dashes

Steps Inline

Dots in a Card

Choose the state to incorporate your LLC

Recommended

State

Server-Driven, with Links Back

acme.example.com is taken. Try acme-hq or acme-labs.

API

Arguments
UI::Stepper.new(current: 1, orientation: :horizontal, variant: :default, align: :start, layout: :stacked, connector: true, labels: true, navigable: nil, label: nil, class: nil, **html_attrs)
Slots: with_step with_completion

Notes

The steps of a multi-step flow, each one done, current, still to come, or in trouble. `current:` is the 1-based number of the step someone is on: steps before it are done, and `current: steps + 1` marks them all done. A step can set its own state with `status:` (:complete, :current, :upcoming, :error or :loading), for one that failed or is still being checked. Looks: `variant: :default` draws numbered circles and `:dot` small dots. Horizontal steppers put each title under its step, `align: :start` (at the left of it) or `:center`; `orientation: :vertical` puts it beside, with room for a description and more. `connector: false` drops the lines, and `labels: false` keeps the titles for screen readers only. Where it has less than 28rem (a phone, a narrow card), a horizontal stepper shows just its steps, with "Step 2 of 4" and the current title under them. A step's block is its panel: what someone fills in on that step. Give the steps panels and the stepper moves between them in the browser; a button with `data-action="ui--stepper#next"` checks the panel's fields and moves on, marking the step as an error if one is invalid, and `ui--stepper#previous` goes back, as does clicking a done step (`navigable: false` turns that off). Moving on is only ever by Continue, so a panel is never skipped unchecked. Give a button `data-ui--stepper-target="next"` or `"previous"` and it hides when there's nowhere to go, and `"submit"` shows only on the last step. Panels sit under the steps; `layout: :side` puts a vertical stepper beside them, given the room, and `layout: :inline` puts each one under its step's title. The stepper's own block comes after the panels, for those buttons; `with_completion` is shown once every step is done. To validate on the server instead, render the stepper with the step the server says someone is on and post each panel's form. While a form inside the stepper is submitting, its current step shows a spinner. Give a done step an `href:` to let people go back to it. Screen readers hear each step's state, and the current one has aria-current="step".