Data displayStepItem
Searchastronomic.dev# StepItem
For one step in a Steps list: its number, title, phase and text. The steps recipes use it for you.
Static: no JavaScript.
## Usage
```astro
import StepItem from "@astronomic-dev/ui/components/StepItem.astro";
```
## Examples
### In a Steps list
Two steps in a Steps list: one with a phase and a text, one with only a title. The steps recipes build their steps from it, so you only need it for your own layout.
```astro
---
import StepItem from "@astronomic-dev/ui/components/StepItem.astro";
import Steps from "@astronomic-dev/ui/components/Steps.astro";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
const heading = "How we work";
const tag = childHeadingTag({ heading });
---
<div class="mx-auto max-w-6xl">
<Steps heading={heading} listClass="@3xl/steps:grid-cols-2">
<StepItem number={1} title="A title, a phase and a text" meta="Week 1" text="The number shows large in the accent; the list gives the order to a screen reader." headingTag={tag} />
<StepItem number={2} title="Only a title" headingTag={tag} />
</Steps>
</div>
```
## Props
### StepItem
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | None | Required. The title, in the heading role in display type. |
| `meta` | `string` | None | A short timing or phase note under the title, such as "Weeks 2–3", in the small role, muted. |
| `text` | `string` | None | A short text under the title, in the body role, muted, at the running-text width (max-w-prose). |
| `number` | `number \| string` | None | Required. The step's number, in the accent: large in the step role, or as a recipe's numberClass draws it (StepsColumns: a small marker). Pass the index plus one, or a string to show as written, such as an index mark "(01)"; an empty string shows no number at all (a theme with its index marks off). The list gives the order to a screen reader, so the number is hidden from it. |
| `headingTag` | `"h2" \| "h3" \| "h4" \| "h5"` | None | Required. The title element. Pass childHeadingTag({ heading, headingTag }) from lib/heading.ts, one level under the section heading. |
| `numberClass` | `string` | None | For recipes. The number's type and frame, in place of the step role (stepType in lib/display.ts), such as StepsColumns' round marker. The accent color stays. |
| `headClass` | `string` | None | For recipes. Wraps the number in a box (data-step-head) with these classes, for a mark beside it, such as StepsColumns' path line. Without it, the number is the step's first child. |
| `metaInHead` | `boolean` | `false` | For recipes. The step's head line: the head box (data-step-head, with headClass) holds the number and then the meta (data-step-meta), one line at the head of the step, in place of the meta under the title. The meta takes the head's type and color, so set them in headClass (such as flex-wrap justify-between and a small muted face). |
| `metaPlacement` | `"below" \| "above"` | `"below"` | Where the meta sits in the text block: under the title, or above it, between the head and the title, in the DOM too, as a timing line read before the title. Ignored with metaInHead. |
| `metaClass` | `string` | None | The meta's type and color, after its own classes (also on the head line's meta), such as font-semibold uppercase tracking-wider text-accent. |
| `titleClass` | `string` | None | For recipes. Classes for the title, after its own, such as a larger type role (text-subhead). |
| `textClass` | `string` | None | For recipes. Classes for the text block (data-step-text: the title, the meta under it and the text), such as a gap. mt-auto sets it at the foot of a tall step only when the recipe makes the <li> a flex column (class="flex flex-col"): in the part's own grid it does nothing. |
| `class` | `string` | None | More classes for the <li>, merged with cn(), so yours win on conflicts. Each step is a named size container (step), so its number sizes to its own column. |
Any other attribute goes on the <li>.
## Accessibility
- Renders one <li>: put it in a Steps list, which is an ordered list.
- The number is aria-hidden: a screen reader hears "list, N items" and the steps in order, never the number.
- The title is the heading level you pass. Use childHeadingTag so it sits one level under the section heading.
StepItem
FreeFor one step in a Steps list: its number, title, phase and text. The steps recipes use it for you.
- File
- StepItem.astro
- Group
- Data display
- Kind
- Static: no JavaScript
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
In a Steps list
Two steps in a Steps list: one with a phase and a text, one with only a title. The steps recipes build their steps from it, so you only need it for your own layout.
How we work
A title, a phase and a text
Week 1
The number shows large in the accent; the list gives the order to a screen reader.
Only a title
Force statemain.astro
examples/stepitem/main.astro
---
import StepItem from "@astronomic-dev/ui/components/StepItem.astro";
import Steps from "@astronomic-dev/ui/components/Steps.astro";
import { childHeadingTag } from "@astronomic-dev/ui/lib/heading.ts";
const heading = "How we work";
const tag = childHeadingTag({ heading });
---
<div class="mx-auto max-w-6xl">
<Steps heading={heading} listClass="@3xl/steps:grid-cols-2">
<StepItem number={1} title="A title, a phase and a text" meta="Week 1" text="The number shows large in the accent; the list gives the order to a screen reader." headingTag={tag} />
<StepItem number={2} title="Only a title" headingTag={tag} />
</Steps>
</div>Minimal · Light