Badge
Genel görünümimport { Badge, StatusBadge } 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.
Görünümler
Dört işleyiş. Adı style değil appearance — style React’in kendi prop’u ve onu almak satır içi stili olanaksız kılardı.
import { Badge } from "@nili/ui"
export function Example() {
return (
<>
<Badge appearance="filled">Filled</Badge>
<Badge appearance="light">Light</Badge>
<Badge appearance="lighter">Lighter</Badge>
<Badge appearance="stroke">Stroke</Badge>
</>
)
}Renkler
On renk, her görünümle serbestçe birleşir. Renk süstür — anlamı etikete koyun.
import { Badge } from "@nili/ui"
export function Example() {
return (
<>
<Badge color="gray">Gray</Badge>
<Badge color="blue">Blue</Badge>
<Badge color="green">Green</Badge>
<Badge color="red">Red</Badge>
</>
)
}Boyutlar
medium (20px) ve small (16px).
import { Badge } from "@nili/ui"
export function Example() {
return (
<>
<Badge size="medium">Medium</Badge>
<Badge size="small">Small</Badge>
</>
)
}Nokta, simgeler ve sayılar
dot başa bir nokta koyar; startIcon ve endIcon her düğümü alır. Çıplak bir sayı da yalnızca children’dır — ayrı bir sayaç prop’u yoktur.
import { Badge, Icon } from "@nili/ui"
import { RiSparkling2Line, RiArrowUpLine } from "@remixicon/react"
export function Example() {
return (
<>
<Badge color="green" appearance="light" dot>
Active
</Badge>
<Badge color="purple" startIcon={<Icon icon={RiSparkling2Line} />}>
New
</Badge>
<Badge color="green" endIcon={<Icon icon={RiArrowUpLine} />}>
12%
</Badge>
<Badge color="red">2</Badge>
</>
)
}Durum rozeti
Ayrı bir bileşen, çünkü renk durumdan gelir: “Completed” rozeti yanlışlıkla kırmızı çizilemez. stroke ya da light, simgeyle veya noktayla.
import { StatusBadge } from "@nili/ui"
export function Example() {
return (
<>
<StatusBadge status="completed">Completed</StatusBadge>
<StatusBadge status="pending" appearance="light">Pending</StatusBadge>
<StatusBadge status="failed" dot>Failed</StatusBadge>
<StatusBadge status="disabled" icon={false}>Disabled</StatusBadge>
</>
)
}Badge
extends Omit< ComponentPropsWithoutRef<'span'>, 'color' | 'children' >
Varyant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| appearance | filled | light | lighter | stroke | filled | Visual treatment. |
| color | gray | red | blue | orange | green | yellow | purple | sky | pink | teal | gray | |
| size | medium | small | medium | |
| disabled | boolean | false |
Diğer proplar
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| children | ReactNode | — | Badge content. Replaces the old `label` / `number` / `number_label` trio: a boolean flag plus two parallel content props meant three ways to say the same thing and one of them was always ignored. |
| aria-label | string | — | |
| dot | boolean | false | Renders a dot before the label. Mutually exclusive with `startIcon`. |
| startIcon | ReactNode | — | |
| endIcon | ReactNode | — |
BadgeDot
dahiliVaryant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| size | medium | small | medium |
BadgeDotSlot
dahiliBadgeIcon
dahiliVaryant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| size | medium | small | medium |
StatusBadge
extends Omit< ComponentPropsWithoutRef<'span'>, 'children' >
Diğer proplar
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| children | ReactNode | — | |
| aria-label | string | — | |
| status | disabled | completed | pending | failed | completed | |
| appearance | light | stroke | stroke | |
| dot | boolean | false | Leading status dot instead of the icon. Decorative — the label carries the meaning. |
| icon | boolean | ReactNode | true | Leading status glyph. `true` (default) shows the Figma icon for `status`, a node replaces it, `false` hides it. |