@akhatmirzo/ui

Stepper

A progress indicator for multi-step flows like checkout, sign-up and setup wizards.

  1. 2-qadam, 4 tadan: Yetkazib berishManzil va vaqt
  2. 3-qadam, 4 tadan: To'lov
  3. 4-qadam, 4 tadan: Tasdiqlashixtiyoriy

2-qadam, 4 tadan:Yetkazib berish

Import

import { Stepper } from '@akhatmirzo/ui';

When to use

  • Sequential flows — checkout (Cart → Delivery → Payment), sign-up, application forms. Users see where they are and how much is left.
  • 3–6 steps work best. If you have more, group them.
  • Not for independent sections — use Tabs for those.
  • Not for site structure — use Breadcrumb.

Steps and statuses

steps is a list of { title, description?, icon?, optional?, status? }. value is the current step index (0-based). Each step's status (data-status) is derived automatically:

StatusWhenCircle
completeindex < valuefilled primary + ✓
currentindex = valueprimary border with a halo
upcomingindex > valuegray border + number
errorstep has status: 'error'danger fill + !

value={steps.length} marks every step as complete. The connector fills with primary up to the current step (300ms).

  1. 1-qadam, 4 tadan: Ma'lumotlar, bajarildi
  2. 2-qadam, 4 tadan: Hujjatlar, xatoPasport rasmi o'qilmadi
  3. 3-qadam, 4 tadan: Tekshiruv
  4. 4-qadam, 4 tadan: Shartnoma

3-qadam, 4 tadan:Tekshiruv

With onValueChange, completed steps become buttons, so users can go back and fix their input. allowFutureSteps lets them jump ahead too (useful for optional setup wizards). The current step is never a button.

Vertical

orientation="vertical" stacks the steps in a column — handy for long descriptions or a side panel.

  1. 2-qadam, 4 tadan: To'lov usullariClick, Payme, naqd

Sizes

size — sm (24px circle) or md (32px, default).

  1. 1-qadam, 3 tadan: Savat, bajarildi
  2. 2-qadam, 3 tadan: Yetkazib berish
  3. 3-qadam, 3 tadan: To'lov

2-qadam, 3 tadan:Yetkazib berish

  1. 1-qadam, 3 tadan: Savat, bajarildi
  2. 2-qadam, 3 tadan: Yetkazib berish
  3. 3-qadam, 3 tadan: To'lov

2-qadam, 3 tadan:Yetkazib berish

Compact view

compact="auto" (default) switches a horizontal stepper to 2 / 4 · Yetkazib berish plus a progress bar on screens narrower than 640px. Both views are rendered and CSS hides one, so there is no SSR hydration mismatch. compact always uses the compact view, compact={false} never does.

2-qadam, 4 tadan:Yetkazib berish

Props

Other <div> attributes go to the root; aria-label / aria-labelledby go to the <ol> list.

PropTypeDefaultDescription
stepsrequired{ title: ReactNode; description?: ReactNode; icon?: ReactNode; optional?: boolean; status?: 'error' }[]—The steps
valuenumber—Current step index, 0-based (controlled)
defaultValuenumber0Initial step
onValueChange(index: number) => void—Makes completed steps clickable
allowFutureStepsbooleanfalseAllow jumping to upcoming steps
orientation'horizontal' | 'vertical''horizontal'Direction
size'sm' | 'md''md'Circle: 24 / 32px
compactboolean | 'auto''auto'Compact view; `auto` — horizontal only, below 640px
labels{ step?: (i, n) => string; optional?; completed?; error? }—Screen reader texts (Uzbek by default)

Data attributes

AttributeWhereValue
data-statusstep, indicatorcomplete · current · upcoming · error
data-clickablestep buttonpresent on clickable steps
data-orientationroot, listhorizontal · vertical
data-sizerootsm · md

Accessibility

  • Structure. Steps live in an <ol>; give it an aria-label ("Order steps").
  • The current step has aria-current="step".
  • Hidden texts. Each step starts with "2-qadam, 4 tadan" (step 2 of 4); completed steps add "bajarildi" and errors add "xato". Color is not the only signal — there are ✓ and ! icons too.
  • Keyboard. Clickable steps are plain <button>s: Tab to move, Enter / Space to select. Other steps are not focusable.
  • Motion. Connector and color transitions are disabled under prefers-reduced-motion.

On this page