# Rokkit Stepper Component > Multi-step progress indicator with stages and optional sub-steps. The Stepper component displays a visual progress indicator for multi-step processes, showing completed, active, and pending stages with optional sub-step dots. ## Quick Start ```svelte ``` ## Core Concepts ### Stage Structure Each stage has visual and state properties: ```javascript const stages = [ { text: '1', // Stage indicator (number/icon) label: 'Step Name', // Label below completed: true, // Is this stage done? active: false, // Is this the current stage? steps: { // Optional sub-steps count: 3, value: 2, current: 1 } } ] ``` ### With Sub-Steps Add granular progress within stages: ```svelte ``` ### Stage States Stages can be in different visual states: - **Completed**: Stage is done (checkmark or filled) - **Active**: Currently in progress - **Pending**: Not yet reached (grayed out) ## Props | Prop | Type | Default | Description | |------|------|---------|-------------| | `data` | `array` | Required | Stage definitions | | `currentStage` | `number` | `0` | Index of active stage | ### Stage Object Properties | Property | Type | Description | |----------|------|-------------| | `text` | `string` | Stage indicator (number, icon, text) | | `label` | `string` | Stage name displayed below | | `completed` | `boolean` | Whether stage is complete | | `active` | `boolean` | Whether stage is current | | `steps` | `object` | Optional sub-steps configuration | ### Steps Object Properties | Property | Type | Description | |----------|------|-------------| | `count` | `number` | Total number of sub-steps | | `value` | `number` | Number of completed sub-steps | | `current` | `number` | Index of current sub-step | ## Events | Event | Payload | Description | |-------|---------|-------------| | `click` | `{ stage, step?, data }` | Stage or step clicked | ## Component Structure ```
├── // Stages row │ ├──
// Stage container │ │ └── // Stage circle │ ├──
// Steps container (if steps) │ │ └── // Sub-step dots │ └── ... // More stages └── // Labels row └──

// Stage label

``` ## Styling The Stepper uses CSS custom properties and Tailwind classes: ```css .stepper { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px; border: 1px solid var(--border-color); border-radius: 8px; box-shadow: var(--shadow-sm); } .stepper row { display: grid; width: 100%; /* Dynamic columns based on --count */ grid-template-columns: repeat(var(--count), 2fr 6fr 2fr); } .stepper .pending { color: var(--surface-500); font-weight: 300; } ``` ### Stage Styling The Stage component displays the circular indicator: ```css /* Stage circle */ [data-stage] { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; } [data-stage].completed { background: var(--success-500); color: white; } [data-stage].active { background: var(--primary-500); color: white; } [data-stage].pending { background: var(--surface-200); color: var(--surface-500); } ``` ## Import ```javascript // Named import import { Stepper } from '@rokkit/ui' // Default import import Stepper from '@rokkit/ui/stepper' ``` ## TypeScript Types ```typescript interface StepperProps { data: StageData[] currentStage: number } interface StageData { text: string label?: string completed?: boolean active?: boolean steps?: { count: number value: number current: number } } ``` ## Examples ### Basic Checkout Flow ```svelte ``` ### With Icons ```svelte ``` ### Form Wizard with Sub-Steps ```svelte ``` ### Interactive Stepper ```svelte
``` ### Onboarding Flow ```svelte ``` ### Order Tracking ```svelte ``` ### Vertical Layout (Custom) ```svelte
``` ## Related Components - **ProgressBar** - Simple progress indicator - **ProgressDots** - Dot-based progress (used for sub-steps) - **BreadCrumbs** - Navigation path - **Tabs** - Tab-based navigation