Scroll walkthrough
The <ScrollWalkthrough> component pairs a column of prose steps with a code panel pinned beside them. Each step or substep names a file and a line range. When it scrolls into view, the panel shows that file with the other lines dimmed. Use it for quickstarts and integration guides where successive steps add to the same few files.
Usage
A walkthrough can contain a single file or several. Declare each file once as a fenced code block inside the component, then point steps and substeps at it with file and a line range in focus or highlight. A step or substep that omits file keeps the previously targeted file.
Install the SDK
Add the Plant Store SDK to your project.
Create the client
Point the client at your garden with an API key.
- Import the client.
- Construct it with your API key.
Add a plant
Create your first plant record. The
wateringDaysinterval drives care reminders.
On narrow screens the panel pins to the top of the viewport, step headers stop sticking, and each substep’s code renders inline beneath it.
Variants
Wide layout
Set layout="wide" to narrow the prose column and give the code panel more room. Pair it with panelHeight to set the panel’s height.
Fetch a plant
Read a single plant by ID.
Log a watering
Record care events to keep the plant’s schedule accurate.
Bulleted substeps
Set substepStyle="bullet" to mark substeps with dots instead of numbers. Use it when the substeps under a step aren’t ordered.
Configure care defaults
Each field controls one reminder.
- Set the watering interval in days.
- Set the fertilizing interval in weeks.
- Choose where reminders are delivered.
Highlighted lines
focus dims every line outside its range. highlight marks its range with an accent background and leaves the rest of the file at full contrast. Use highlight for steps where the surrounding code still matters.
Configure the client
Set your API key and a request timeout.
Shorten the watering interval
Summer growth needs more frequent watering, so drop the interval to five days.
Properties
<ScrollWalkthrough> properties
Column split. wide narrows the prose column to give the code panel more room.
Height of the code panel as a CSS length, such as 32rem. Defaults to a viewport-based height.
Whether each step’s header stays pinned while its substeps scroll.
Whether inactive steps and substeps fade out.
Whether substeps are marked with numbers (step) or dots (bullet).
Additional CSS classes to apply to the walkthrough
<Step> properties
Inside a walkthrough, <Step> accepts these properties:
The step’s heading
A short summary rendered under the title
The file this step targets, matching a code block’s title or its 0-based index among the walkthrough’s code blocks. When omitted, the step keeps the previously targeted file.
Lines to focus in the targeted file, dimming the rest. Accepts a range string such as 1-5,8, a single line number, or an array of line numbers.
Lines to highlight in the targeted file, using the same formats as focus.
The 1-based line the panel scrolls to when the step becomes active. Defaults to the first focused or highlighted line.
The unique ID for the step, used for linking. Generated automatically when unset.
<Substep> properties
A short heading rendered above the substep’s prose
The file this substep targets, matching a code block’s title or its 0-based index. When omitted, the substep inherits the step’s file.
Lines to focus in the targeted file, dimming the rest. Accepts a range string such as 1-5,8, a single line number, or an array of line numbers.
Lines to highlight in the targeted file, using the same formats as focus.
The 1-based line the panel scrolls to when the substep becomes active. Defaults to the first focused or highlighted line.
The unique ID for the substep, used for linking. Generated from the parent step when unset.