StepIndicator
عرض شاملimport { Step, StepIndicator, StepIndicatorLabels, StepperDot } from '@nili/ui';هذه صفحة العرض الشامل الخاصة بالمكتبة، معروضة حيّة. غيّر اللغة أو السمة من الأعلى وسَتتبعك.
أفقي
value هو ترتيب الخطوة الحالية بدءًا من الصفر. ويُقرأ كل ما قبلها مكتملًا وكل ما بعدها افتراضيًا — فالحالات الثلاث تنبع من الموضع مجانًا.
import { StepIndicator, Step } from "@nili/ui"
export function Example() {
return (
<StepIndicator value={1} labels={{ root: "Checkout" }}>
<Step label="Account" />
<Step label="Profile" />
<Step label="Billing" />
<Step label={t('step.done')} />
</StepIndicator>
)
}مع أوصاف
سطر ثانٍ تحت التسمية. أبقِه قصيرًا — فالمؤشّر خريطة للمسار لا المسار نفسه.
import { StepIndicator, Step } from "@nili/ui"
export function Example() {
return (
<StepIndicator value={2} labels={{ root: "Checkout" }}>
<Step label="Account" description="Email and password" />
<Step label="Profile" description="Name and photo" />
<Step label="Billing" description="Card details" />
</StepIndicator>
)
}رأسي
المكوّن نفسه مكدّسًا. مناسب لشريط جانبي أو لمسار بتسميات طويلة لا تتّسع في صفّ واحد.
import { StepIndicator, Step } from "@nili/ui"
export function Example() {
return (
<StepIndicator orientation="vertical" value={1} labels={{ root: "Setup" }}>
<Step label="Account" description="Email and password" />
<Step label="Profile" description="Name and photo" />
<Step label="Billing" description="Card details" />
</StepIndicator>
)
}خطوات يمكن العودة إليها
يجعل onSelect الخطوة زرًّا حقيقيًا — لمعالج يمكن العودة إلى خطواته السابقة. وبدونه تبقى الخطوة نصًّا خاملًا، وهو الصواب حين يكون المسار للأمام فقط.
import { StepIndicator, Step } from "@nili/ui"
export function Example() {
const [current, setCurrent] = useState(1)
return (
<StepIndicator value={current} labels={{ root: "Checkout" }}>
{steps.map((step, index) => (
<Step
key={step.label}
label={step.label}
onSelect={index <= current ? () => setCurrent(index) : undefined}
/>
))}
</StepIndicator>
)
}علامات مخصّصة وحالة مفروضة
يستبدل icon الرقم أو علامة الصح. ويتجاوز status الحالة المشتقّة من value — نادرًا ما يلزم، لكنه موجود لخطوة فشل تحقّقها ويجب أن تبقى معلّمة.
import { StepIndicator, Step, Icon } from "@nili/ui"
import { RiUser3Line, RiCheckLine } from "@remixicon/react"
export function Example() {
return (
<StepIndicator value={1} labels={{ root: "Setup" }}>
<Step label={t('step.account')} icon={<Icon icon={RiCheckLine} />} />
<Step label={t('step.profile')} icon={<Icon icon={RiUser3Line} />} />
<Step label={t('step.billing')} status="completed" />
</StepIndicator>
)
}نقطة التدرّج
الشكل المدمج: بلا تسميات، الموضع فقط. لدوّارات التعريف وأوراق الهاتف، حيث يلتهم المؤشّر المسمّى الشاشة كلها.
import { StepperDot } from "@nili/ui"
export function Example() {
return (
<>
<StepperDot count={4} value={1} label="Onboarding" />
<StepperDot count={4} value={1} size="xs" label="Onboarding" />
</>
)
}Step
extends Omit< ComponentPropsWithoutRef<'button'>, 'value' >
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| children | ReactNode | — | |
| disabled | boolean | — | |
| required | boolean | — | |
| readOnly | boolean | — | |
| value | string | — | |
| defaultValue | string | — | |
| name | string | — | |
| aria-label | string | — | |
| label | ReactNode | — | |
| description | ReactNode | — | |
| status | default | completed | active | — | Overrides the state derived from the indicator's `value`. Rarely needed — all three states follow from the position for free. |
| icon | ReactNode | — | Replaces the number or the tick. |
| onSelect | () => void | — | Makes the step a real button — for a wizard whose earlier steps can be revisited. Without it the step is inert text, which is right when the flow is strictly forward. |
StepConnector
داخليمحاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| orientation | horizontal | vertical | horizontal | |
| complete | 'true' | 'false' | false |
StepDescription
داخليStepIndicator
extends Omit< ComponentPropsWithoutRef<'nav'>, 'children' >
محاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| orientation | horizontal | vertical | horizontal |
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| children* | ReactNode | — | |
| aria-label | string | — | |
| value | number | 0 | Index of the current step, 0-based. |
| locale | string | — | BCP-47 tag for the step numbers (`'fa'` → Persian). Defaults to the ambient locale from `NiliProvider`. |
| labels | StepIndicatorLabels | — |
StepItem
داخليمحاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| orientation | horizontal | vertical | horizontal | |
| interactive | 'true' | 'false' | false |
StepLabel
داخليمحاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| status | completed | active | default | default |
StepMarker
داخليمحاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| status | completed | active | default | default |
StepperDot
extends Omit< ComponentPropsWithoutRef<'div'>, 'children' >
محاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| size | sm | xs | sm | |
| active | 'true' | 'false' | false |
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| children | ReactNode | — | |
| aria-label | string | — | |
| count | number | 3 | Number of dots. |
| value | number | 0 | Index of the active dot, 0-based. Figma's "1st / 2nd / 3rd Active". |
| label | string | — | Accessible name, e.g. `'Form steps'`. |
| formatProgress | (index: string, total: string) => string | — | How the position is announced. |
| locale | string | — |