StepIndicator
Genel görünümimport { Step, StepIndicator, StepIndicatorLabels, StepperDot } from '@nili/ui';Bu, kütüphanenin kendi genel görünüm sayfası — canlı olarak render ediliyor. Üstten dili veya temayı değiştirin, o da değişir.
Yatay
value, geçerli adımın sıfırdan başlayan dizinidir. Ondan öncekiler tamamlanmış, sonrakiler varsayılan okunur — üç durum da konumdan bedavaya çıkar.
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>
)
}Açıklamalarla
Etiketin altında ikinci bir satır. Kısa tutun — gösterge akışın haritasıdır, akışın kendisi değil.
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>
)
}Dikey
Aynı bileşen, yığılmış. Bir kenar çubuğu ya da bir satıra asla sığmayacak uzun etiketli bir akış için doğrudur.
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>
)
}Yeniden ziyaret edilebilir adımlar
onSelect bir adımı gerçek bir düğme yapar — önceki adımlarına dönülebilen bir sihirbaz için. Onsuz adım cansız bir metindir ki akış katı biçimde ileriye doğruysa doğrusu budur.
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>
)
}Özel işaretler ve zorlanan durum
icon sayının ya da onay işaretinin yerini alır. status, göstergenin value’sundan türeyen durumu geçersiz kılar — seyrek gerekir ama doğrulaması başarısız olup işaretli kalması gereken bir adım için vardır.
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>
)
}Adım noktası
Derli toplu biçim: etiket yok, yalnızca konum. Tanıtım galerileri ve mobil sayfalar için — etiketli bir gösterge tüm ekranı yerdi.
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' >
Diğer proplar
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| 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
dahiliVaryant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| orientation | horizontal | vertical | horizontal | |
| complete | 'true' | 'false' | false |
StepDescription
dahiliStepIndicator
extends Omit< ComponentPropsWithoutRef<'nav'>, 'children' >
Varyant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| orientation | horizontal | vertical | horizontal |
Diğer proplar
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| 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
dahiliVaryant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| orientation | horizontal | vertical | horizontal | |
| interactive | 'true' | 'false' | false |
StepLabel
dahiliVaryant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| status | completed | active | default | default |
StepMarker
dahiliVaryant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| status | completed | active | default | default |
StepperDot
extends Omit< ComponentPropsWithoutRef<'div'>, 'children' >
Varyant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| size | sm | xs | sm | |
| active | 'true' | 'false' | false |
Diğer proplar
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| 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 | — |