انتقل إلى المحتوى
TopClass UI

مؤشر الخطوات

أين يقف القارئ في مهمة من بضع خطوات. الخطوة المكتملة تحمل علامة صح لا لونًا فقط، فتبقى واضحة في لقطة شاشة رمادية.

server - 0 KB

مؤشر الخطوات

server - 0 KB

أين يقف القارئ في مهمة من بضع خطوات. الخطوة المكتملة تحمل علامة صح لا لونًا فقط، فتبقى واضحة في لقطة شاشة رمادية.

تثبيت
  1. AccountCompleted
  2. Profile
  3. TeamNot started
  4. DoneNot started

جرّبه

size

الشيفرة

stepper.tsx
import { Stepper, type StepperDesignProps } from 'topclassui/stepper'

<Stepper items={STEPS} value="profile" aria-label="Sign-up" />

مؤشر الخطوات يُعرض على الخادم: مرّر value، أي معرّف الخطوة الحالية. هو يعرض التقدّم ولا ينقل بين الصفحات.

كل الحالات، بدون تمرير الفأرة

4 حالات
  1. Cart
  2. AddressNot started
  3. PaymentNot started
  1. CartCompleted
  2. Address
  3. PaymentNot started
  1. CartCompleted
  2. AddressNeeds attention
  3. PaymentNot started
  1. CartCompleted
  2. AddressCompleted
  3. PaymentCompleted

أو استورده من الحزمة

topclassui/stepper
import { Stepper } from 'topclassui/stepper'

ثبّت مرة واحدة:npm i topclassui@beta zod

أمثلة

  • الخطوة هي { id, title, status? }، وstatus واحدة من done وcurrent وtodo وerror.
  • الخطوات قبل value مكتملة، والخطوات بعدها لم تبدأ. بلا value تكون الخطوة الأولى هي الحالية، وvalue لا تملكه أي خطوة يترك كل الخطوات لم تبدأ.
  • status الخاصة بالخطوة تتقدّم على value: الحالة error ترسم علامة x وتُقرأ «يحتاج إلى مراجعة».
  • size يحدّد الدوائر، من 24 إلى 48 بكسل، والعناوين. ومع custom تقرأ الدائرة --tc-stepper-mark، وهو 32 بكسل ما لم تضبطه.
  • العنوان الطويل يلتفّ داخل عموده ولا يُقصّ أبدًا. والخطوات التي لا تتسع في سطر واحد تنتقل إلى سطر آخر، فلا تُمرَّر الصفحة أفقيًا أبدًا.
basic
  1. AccountCompleted
  2. Profile
  3. TeamNot started
  4. DoneNot started
statuses
  1. UploadCompleted
  2. CheckNeeds attention
  3. Publish
  4. ShareNot started
sizes
  1. CartCompleted
  2. Address
  3. PaymentNot started
  1. CartCompleted
  2. Address
  3. PaymentNot started
  1. CartCompleted
  2. Address
  3. PaymentNot started
  1. CartCompleted
  2. Address
  3. PaymentNot started
  1. CartCompleted
  2. Address
  3. PaymentNot started
custom-size
  1. UploadCompleted
  2. CheckNeeds attention
  3. Publish
  4. ShareNot started
  1. UploadCompleted
  2. CheckNeeds attention
  3. Publish
  4. ShareNot started
long-content
  1. Confirm the billing address on the orderCompleted
  2. Choose a delivery slot for the big itemsCompleted
  3. Add the gift note and the wrapping paper
  4. Review every line of the order, then payNot started
  5. Pay with a saved card or a bank transferNot started
  6. Download the receipt and tracking numberNot started
arabic-digits
  1. السلةمكتمل
  2. العنوانمكتمل
  3. الدفع
  4. التأكيدلم يبدأ
  1. السلةمكتمل
  2. العنوانمكتمل
  3. الدفع
  4. التأكيدلم يبدأ
بالعربية، من اليمين إلى اليسار
  1. الحسابمكتمل
  2. الملف الشخصي
  3. الفريقلم يبدأ
  4. تملم يبدأ

الخصائص

خصائص Stepper
الخاصيةالنوعالافتراضيالحدودالوصف
items*readonly StepperItem[]--The steps, first to last. A connector runs from each circle to the next.
labelsLabels--The built-in strings, which say each step's status. Defaults to English; spread getLabels(locale) for another.
localestring--The locale the step numbers are written in: ar-u-nu-arab gives Arabic-Indic digits. Defaults to en.
sizexs | sm | md | lg | xl | custom"md"-The size of the circles (24 to 48 px) and of the titles; custom emits none.
valuestring--The id of the current step: those before it are done, those after it todo. Defaults to the first step's id.

لوحة المفاتيح وإمكانية الوصول

لا شيء يُشغَّل: ليس تفاعليًا بمفرده.

  • قائمة مرتّبة تعطي «2 من 4»، مع role="list" مكتوبًا كي يحتفظ بها Safari مع VoiceOver.
  • الخطوة الحالية تحمل aria-current="step"، ولكل خطوة أخرى كلمة مخفية تقول حالتها، من labels.
  • الدوائر مخفية عن قارئات الشاشة، ولا شيء يأخذ التركيز.

من اليمين إلى اليسار

تبدأ الخطوات من اليمين وحدها. وlocale يحدّد الأرقام: ar-u-nu-arab يكتب الأرقام بالهندية الشرقية.

الخادم والمتصفح

يُعرض على الخادم ولا يرسل أي JavaScript.

الملفات: index.tsx.

على الشارة: server - 0 KB.