Stepper
A flow in steps — sign-up, checkout, a form too long for one screen: each step a tab and its panel, in order if you like, each step's form valid before the next. It looks like the Timeline.
Usage
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScStepper, ScStepperConnector, ScStepperDescription, ScStepperIndicator, ScStepperItem, ScStepperList, ScStepperNext, ScStepperPanel, ScStepperPrevious, ScStepperTitle, ScStepperTrigger,} from '@semantic-components/ui';import { SiCheckIcon } from '@semantic-icons/lucide-icons';
/** Three steps across, each a tab — its indicator (a check once done), title and description; a connector to the next, filled once done; Back and Continue, or the steps themselves. */@Component({ selector: 'app-stepper-usage-demo', imports: [ ScFrame, ScStepper, ScStepperConnector, ScStepperDescription, ScStepperIndicator, ScStepperItem, ScStepperList, ScStepperNext, ScStepperPanel, ScStepperPrevious, ScStepperTitle, ScStepperTrigger, SiCheckIcon, ], template: ` <div scFrame class="w-full max-w-2xl p-6"> <div scStepper [(selectedIndex)]="step"> <div scStepperList aria-label="Sign-up steps"> @for (s of steps; track s.title) { <div scStepperItem #item="scStepperItem"> <button scStepperTrigger> <span scStepperIndicator> @if (item.status() === 'complete') { <svg siCheckIcon></svg> } @else { {{ $index + 1 }} } </span> <span scStepperTitle>{{ s.title }}</span> <span scStepperDescription class="max-sm:sr-only">{{ s.description }}</span> </button> <div scStepperConnector></div> </div> } </div> @for (s of steps; track s.title) { <div scStepperPanel [step]="$index"> <p class="text-muted-foreground text-sm">{{ s.content }}</p> </div> } <div class="flex justify-between gap-2"> <button scStepperPrevious>Back</button> <button scStepperNext>Continue</button> </div> </div> </div> `, host: { class: 'flex w-full justify-center' }, encapsulation: ViewEncapsulation.None,})export class StepperUsageDemo { private readonly step = signal(0); private readonly steps = [ { title: 'Account', description: 'Your email and password', content: 'Step 1: choose the email you sign in with, and a password.', }, { title: 'Profile', description: 'You and your team', content: 'Step 2: your name, your role, and who you work with.', }, { title: 'Plan', description: 'Free or Pro', content: 'Step 3: start free, or take Pro for the whole team.', }, ];}Anatomy
The steps are a list of items, each with its trigger (the indicator, the title and a description in it) and the connector to the next; their panels come after the list. Steps are numbered in page order; a panel says which step it belongs to with [step].
import { ScStepper, ScStepperList, ScStepperItem, ScStepperTrigger, ScStepperIndicator, ScStepperTitle, ScStepperDescription, ScStepperConnector, ScStepperPanel, ScStepperPrevious, ScStepperNext,} from '@semantic-components/ui';<div scStepper [(selectedIndex)]="step"> <div scStepperList aria-label="…"> <div scStepperItem #item="scStepperItem"> <button scStepperTrigger> <span scStepperIndicator>…</span> <span scStepperTitle>…</span> <span scStepperDescription>…</span> </button> <div scStepperConnector></div> </div> … </div> <div scStepperPanel [step]="0">…</div> … <button scStepperPrevious>…</button> <button scStepperNext>…</button></div>Linear and validation
- Give a step a
stepControl— a Signal Forms field (form.account): the step is complete once it is valid and has been left once. linear: a step can't be passed while one before it is not complete — by Next, a later trigger or the keys. A refused Next marks the step's fields as touched, so their errors show, and the step becomes failed.optionalsteps may be skipped;editablefalse: a complete step can't be gone back to;completedandhasErrorsay it yourself.status()— complete, current, upcoming, failed — the Timeline's words, chooses your indicator's content (a check, a cross, the number).
Keyboard
- The steps are one Tab stop: ← and → (mirrored right to left), ↑ and ↓ when vertical, Home and End move between them; the step shown follows when it can be reached.
- A step that can't be reached yet is
aria-disabled, still focusable. - The list is a tablist (name it), each trigger a tab, each panel its tabpanel; put the title in the trigger, it names the tab.
Examples
Numbers only
Step 1 of 4: your cart.
Step 2 of 4: where it goes.
Step 3 of 4: how you pay.
Step 4 of 4: check and order.
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScStepper, ScStepperConnector, ScStepperIndicator, ScStepperItem, ScStepperList, ScStepperNext, ScStepperPanel,Vertical
Step 1: choose the email you sign in with, and a password.
Step 2: your name, your role, and who you work with.
Step 3: start free, or take Pro for the whole team.
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScStepper, ScStepperConnector, ScStepperDescription, ScStepperIndicator, ScStepperItem, ScStepperList, ScStepperNext,Linear, with a form
import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, FormRoot, email, form, required,} from '@angular/forms/signals';import { ScButton,RTL
الخطوة ١: اختر البريد الذي تدخل به، وكلمة مرور.
الخطوة ٢: اسمك، ودورك، ومن تعمل معهم.
الخطوة ٣: ابدأ مجانًا، أو اختر الاحترافية للفريق كله.
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScStepper, ScStepperConnector, ScStepperDescription, ScStepperIndicator, ScStepperItem, ScStepperList,API reference
Each part takes class, merged over the style (cn: a later class wins). The look is the style's Timeline: its markers' corners and ring, its line, its titles, its focus ring.
| Part | Selector | Description |
|---|---|---|
ScStepper | div[scStepper] | [(selectedIndex)] (from 0), orientation ('horizontal', 'vertical'), linear. exportAs scStepper: stepCount(), isFirstStep(), isLastStep(), next(), previous(), goToStep(index), reset(), canReach(index). --sc-stepper-indicator: the indicators' size (the style's icon button's). |
ScStepperList | div[scStepperList] | The steps, a tablist (name it): one Tab stop, the arrows, Home and End between steps. |
ScStepperItem | div[scStepperItem] | A step: stepControl (a Signal Forms field), optional, editable (true), completed, hasError. exportAs scStepperItem: status() (complete, current, upcoming, failed), index(), reachable(); data-complete, data-current, data-upcoming, data-failed. |
ScStepperTrigger | button[scStepperTrigger] | Its tab: goes to the step; aria-disabled while it can’t be reached. Holds the indicator, the title and a description. |
ScStepperIndicator | span[scStepperIndicator] | Its mark, your number or icon: filled when complete, ringed when current, muted when upcoming, destructive when failed — as the Timeline’s markers. |
ScStepperTitle, ScStepperDescription | span[scStepperTitle], span[scStepperDescription] | Its name (it names the tab) and a line under it. |
ScStepperConnector | div[scStepperConnector] | The line to the next step, after the trigger: the primary colour once the step is complete; none after the last. |
ScStepperPanel | div[scStepperPanel] | Step [step]’s content, a tabpanel named by its trigger; shown while that step is. |
ScStepperPrevious, ScStepperNext | button[scStepperPrevious], button[scStepperNext] | The style’s button (outline, default): the previous step (disabled on the first), the next (refused: the step’s errors show). |