ProgressBar
Genel görünümimport { ProgressBar, ProgressCircle } 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.
Temel
value 0…max aralığına kırpılır. Görünür etiketi olmayan çıplak bir çubuk aria-label ister — bir tablo hücresinde onu adlandıracak başka bir şey yoktur.
import { ProgressBar } from "@nili/ui"
export function Example() {
return (
<>
<ProgressBar value={35} aria-label={t('upload')} />
<ProgressBar value={70} label={t('storage')} showValue />
<ProgressBar value={7} max={10} label="Files" valueLabel="7 of 10 files" />
</>
)
}Renkler
Dört renk. Renk bir sinyaldir, süs değil — warning ve error, sayının yüksek değil kötü olduğunu anlatmalı.
import { ProgressBar } from "@nili/ui"
export function Example() {
return (
<>
<ProgressBar value={40} color="primary" label="Primary" />
<ProgressBar value={100} color="success" label="Success" />
<ProgressBar value={85} color="warning" label="Warning" />
<ProgressBar value={95} color="error" label="Error" />
</>
)
}Etiket konumu ve eylemler
labelPosition, Figma’daki On Top / On Right’tır ve mantıksaldır — end okuma yönünü izler. linkButton çubuğun altındaki eylemdir.
import { ProgressBar, LinkButton } from "@nili/ui"
export function Example() {
return (
<>
<ProgressBar value={60} label="Storage" labelPosition="top" showValue />
<ProgressBar value={60} label="Storage" labelPosition="end" showValue />
<ProgressBar
value={92}
color="warning"
label="Storage"
showValue
linkButton={<LinkButton href="#" size="sm">Upgrade plan</LinkButton>}
/>
</>
)
}Belirsiz
Süresi bilinmeyen işler için. aria-valuenow’u düşürür; böylece yardımcı teknoloji bir yüzde uydurmak yerine “meşgul” der.
import { ProgressBar, ProgressCircle } from "@nili/ui"
export function Example() {
return (
<>
<ProgressBar indeterminate label={t('indet.syncing')} />
<ProgressCircle indeterminate aria-label={t('indet.loading')} />
</>
)
}İlerleme halkası
Aynı API, halka biçiminde. Altı boyut ve varsayılan kalınlık bağlama uymadığında piksel cinsinden thickness.
import { ProgressCircle } from "@nili/ui"
export function Example() {
return (
<>
<ProgressCircle value={65} showValue aria-label="Complete" />
<ProgressCircle value={65} size={80} showValue aria-label="Complete" />
<ProgressCircle value={65} thickness={2} showValue aria-label="Complete" />
{/* anything in the middle */}
<ProgressCircle value={65} aria-label="Complete">
<span className="text-[12px]">65/100</span>
</ProgressCircle>
</>
)
}ProgressBar
extends ProgressCommonProps, Omit<ComponentPropsWithoutRef<'div'>, 'color' | 'children'>
Diğer proplar
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| children | ReactNode | — | |
| aria-label | string | — | Accessible name when there is no visible `label` — a bare bar in a table cell has nothing to be named by otherwise. |
| value | number | 0 | Current value, clamped to `0…max`. Ignored while `indeterminate`. |
| max | number | 100 | |
| color | error | warning | success | primary | primary | |
| indeterminate | boolean | false | Unknown duration: drops `aria-valuenow` so assistive tech announces "busy" rather than inventing a percentage. |
| label | ReactNode | — | Visible label. Also becomes the accessible name. |
| labelPosition | end | top | top | Figma's label `Type`. |
| linkButton | ReactNode | — | Action under the bar. Figma's "Link Button". |
| showValue | boolean | false | Shows the percentage. |
| valueLabel | ReactNode | — | Overrides the rendered readout — `'3 of 10 files'`, a size, an ETA. |
| locale | string | — | BCP-47 tag driving the digits (`'fa'` → Persian). Defaults to the ambient locale from `NiliProvider`. |
ProgressCircle
extends ProgressCommonProps, Omit<ComponentPropsWithoutRef<'div'>, 'color' | 'children'>
Varyant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| size | 80 | 72 | 64 | 56 | 48 | 40 | 64 |
Diğer proplar
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| children | ReactNode | — | Content in the middle. Defaults to the percentage when `showValue`. |
| aria-label | string | — | Accessible name when there is no visible `label` — a bare bar in a table cell has nothing to be named by otherwise. |
| thickness | number | — | Stroke width in px. |
| value | number | 0 | Current value, clamped to `0…max`. Ignored while `indeterminate`. |
| max | number | 100 | |
| color | error | warning | success | primary | primary | |
| indeterminate | boolean | false | Unknown duration: drops `aria-valuenow` so assistive tech announces "busy" rather than inventing a percentage. |
| label | ReactNode | — | Visible label. Also becomes the accessible name. |
| labelPosition | end | top | — | Figma's label `Type`. |
| linkButton | ReactNode | — | Action under the bar. Figma's "Link Button". |
| showValue | boolean | true | Shows the percentage. |
| valueLabel | ReactNode | — | Overrides the rendered readout — `'3 of 10 files'`, a size, an ETA. |
| locale | string | — | BCP-47 tag driving the digits (`'fa'` → Persian). Defaults to the ambient locale from `NiliProvider`. |
ProgressCircleStroke
dahiliVaryant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| color | primary | success | warning | error | primary |
ProgressCommon
dahiliDiğer proplar
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| value | number | — | Current value, clamped to `0…max`. Ignored while `indeterminate`. |
| max | number | — | |
| color | error | warning | success | primary | — | |
| indeterminate | boolean | — | Unknown duration: drops `aria-valuenow` so assistive tech announces "busy" rather than inventing a percentage. |
| label | ReactNode | — | Visible label. Also becomes the accessible name. |
| labelPosition | end | top | — | Figma's label `Type`. |
| linkButton | ReactNode | — | Action under the bar. Figma's "Link Button". |
| showValue | boolean | — | Shows the percentage. |
| valueLabel | ReactNode | — | Overrides the rendered readout — `'3 of 10 files'`, a size, an ETA. |
| locale | string | — | BCP-47 tag driving the digits (`'fa'` → Persian). Defaults to the ambient locale from `NiliProvider`. |
| aria-label | string | — | Accessible name when there is no visible `label` — a bare bar in a table cell has nothing to be named by otherwise. |
ProgressFill
dahiliVaryant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| color | primary | success | warning | error | primary | |
| indeterminate | 'true' | 'false' | false |
ProgressLabel
dahiliVaryant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| position | top | end | top |