shadcn.io is not affiliated with official shadcn/ui
Accordion Step By Step Blog Block for Radix UI
A tutorial in five steps: a single-open accordion on a vertical rail, a Done button that ticks a step and opens the next, and a framed drawing of the open step.
Installation
Overview
A tutorial block for React with Radix UI, written for Fretsaw Weekly, a woodworking blog: how to cut a through mortise and tenon by hand. A start-aligned header says how many steps are done and about how long the rest takes. Below it, a split behind a divider: at the start a single-open accordion of five steps hung on a vertical rail, each with a marker (a number, a tick once done, a haloed ring for the one you are on), its title and its time; the open step shows its text, what you need and the block's Shine Button, "Done, next step", which ticks the step, opens the next and moves focus to it. At the end a framed drawing of the open step. On a phone the drawing sits under the step's text. It's built from Accordion, ShineButton, Button and Guides. What you tick stays in this page.
FAQ
How do I change the steps?
Edit STEPS: each has an id, a title, the minutes it takes, its text and what you need. The header's "2 of 5 steps done, about 40 minutes to go", the markers and the "Step 3 of 5" caption derive from it. START_DONE and START_OPEN set what is ticked and open on first show. The drawing is chosen by the step's id, so a new step needs a drawing with the same id.
What do the buttons do?
"Done, next step" marks the step done, opens the next one and moves focus to its heading, because the button leaves with the panel it was in. On a step you have already done the button reads "Mark as not done" and takes the tick back. A polite status says what happened ("Step 3 done. Step 4, Pare to a snug fit, is open.").
How does the accordion work from the keyboard?
Enter and Space open a step, and one step is always open. The Up and Down arrows also move between the step headings, and Home and End jump to the first and last.
Is the text of closed steps in the page?
No. This Accordion renders a step's text only while it is open. For search engines, add structured data (HowTo) built from the same STEPS array.