Button
Genel görünümimport { Button, ButtonGroup, CompactButton, FancyButton, LinkButton } 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 görsel stil. Varsayılan filled; daha az görsel ağırlık gerektiğinde stroke, lighter veya ghost kullanın.
import { Button } from "@nili/ui"
export function Example() {
return (
<>
<Button appearance="filled">Filled</Button>
<Button appearance="stroke">Stroke</Button>
<Button appearance="lighter">Lighter</Button>
<Button appearance="ghost">Ghost</Button>
</>
)
}Renkler
primary, neutral, error ve success. Her görünümle serbestçe birleşir.
import { Button } from "@nili/ui"
export function Example() {
return (
<>
<Button color="primary">Primary</Button>
<Button color="neutral">Neutral</Button>
<Button color="error">Error</Button>
<Button color="success">Success</Button>
</>
)
}Boyutlar
Varsayılan md (40px). Küçük boyutlar aynı simge ve tipografi ölçeğini korur.
import { Button } from "@nili/ui"
export function Example() {
return (
<>
<Button size="md">Medium</Button>
<Button size="sm">Small</Button>
<Button size="xs">X-Small</Button>
<Button size="2xs">2X-Small</Button>
</>
)
}Simgelerle
startIcon veya endIcon içine herhangi bir React düğümü verin. Simgenin boyutu ve boşluğu otomatik ayarlanır.
import { Button, Icon } from "@nili/ui"
import { RiArrowLeftSLine, RiArrowRightSLine } from "@remixicon/react"
export function Example() {
return (
<Button
startIcon={<Icon icon={RiArrowLeftSLine} mirrored />}
endIcon={<Icon icon={RiArrowRightSLine} mirrored />}
>
Continue
</Button>
)
}Yalnızca simge
Kare düğmeler. aria-label ile her zaman erişilebilir bir ad verin — simge tek başına ad taşımaz.
import { Button, Icon } from "@nili/ui"
import { RiAddLine } from "@remixicon/react"
export function Example() {
return (
<Button iconOnly aria-label="Add" startIcon={<Icon icon={RiAddLine} />} />
)
}Yükleniyor ve devre dışı
Yükleme durumu özgün genişliği korur, böylece yerleşim zıplamaz. Devre dışı, gerçek disabled özniteliğidir.
import { Button } from "@nili/ui"
export function Example() {
return (
<>
<Button loading loadingLabel="Sending">Send</Button>
<Button disabled>Disabled</Button>
</>
)
}Tam genişlik
Formların ya da mobil sayfaların içinde işe yarar.
import { Button } from "@nili/ui"
export function Example() {
return <Button fullWidth>Continue</Button>
}Bağlantı düğmeleri
Metin ağırlığında, cümlenin içine oturan eylemler. Her zaman altı çizili için underline kullanın; yoksa yalnızca üzerine gelince çıkar.
import { LinkButton, Icon } from "@nili/ui"
import { RiArrowRightSLine } from "@remixicon/react"
export function Example() {
return (
<>
<LinkButton href="#" color="primary">Primary link</LinkButton>
<LinkButton href="#" color="gray">Gray link</LinkButton>
<LinkButton href="#" color="error" underline>
Underlined
</LinkButton>
<LinkButton
href="#"
color="primary"
endIcon={<Icon icon={RiArrowRightSLine} mirrored />}
>
With icon
</LinkButton>
</>
)
}Fancy düğmeler
Bir ekrandaki tek en önemli eylem için kabartmalı varyant. İdareli kullanın — üç tane olursa hiçbiri özel değildir.
import { FancyButton, Icon } from "@nili/ui"
import { RiArrowRightSLine } from "@remixicon/react"
export function Example() {
return (
<>
<FancyButton color="primary">Primary</FancyButton>
<FancyButton color="neutral">Neutral</FancyButton>
<FancyButton color="basic">Basic</FancyButton>
<FancyButton
color="primary"
endIcon={<Icon icon={RiArrowRightSLine} mirrored />}
>
Continue
</FancyButton>
</>
)
}Kompakt düğmeler
Dar alanlar için kare, yalnızca simgeli denetimler — tablo satır eylemleri, alan süsleri, araç çubukları. Her zaman aria-label verin.
import { CompactButton, Icon } from "@nili/ui"
import { RiCloseLine, RiSettings3Line, RiMore2Fill } from "@remixicon/react"
export function Example() {
return (
<>
<CompactButton appearance="stroke" aria-label="Close">
<Icon icon={RiCloseLine} />
</CompactButton>
<CompactButton appearance="ghost" aria-label="Settings">
<Icon icon={RiSettings3Line} />
</CompactButton>
<CompactButton appearance="error" aria-label="Delete">
<Icon icon={RiCloseLine} />
</CompactButton>
</>
)
}Button
extends Omit< ComponentPropsWithoutRef<'button'>, 'color' >
Varyant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| color | primary | neutral | error | success | basic | primary | Figma `🧩 Type` — Primary · Neutral · Error · Success. |
| appearance | filled | stroke | lighter | ghost | filled | |
| size | md | sm | xs | 2xs | md | |
| fullWidth | boolean | false | |
| iconOnly | boolean | false | Square icon-only button. Requires `aria-label` — a button whose only content is an SVG has no accessible name otherwise. |
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 | — | |
| startIcon | ReactNode | — | |
| endIcon | ReactNode | — | |
| loading | boolean | false | Shows a spinner and blocks interaction without collapsing the layout. |
| loadingLabel | string | — | Announced while `loading`, e.g. `'Sending'`. |
| asChild | boolean | false | Render the child element instead of a `<button>`, keeping every style and handler. Use for links: `<Button asChild><a href="…">…</a></Button>`. |
ButtonGroup
extends ComponentPropsWithoutRef<'div'>
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 | — | |
| size | sm | xs | 2xs | sm | |
| role | toolbar | radiogroup | group | toolbar | `'toolbar'` (default) for a row of independent actions. Use `'radiogroup'` when the segments are mutually exclusive choices — the roles are read out differently, and only one of them promises "pick exactly one". |
| label | string | — |
ButtonGroupItem
extends Omit< ComponentPropsWithoutRef<'button'>, 'color' >
Varyant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| selected | boolean | false | |
| iconOnly | boolean | false | |
| size | sm | xs | 2xs | sm | Overrides the size inherited from the group. Rarely needed. |
| orientation | horizontal | vertical | horizontal |
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 | — | |
| startIcon | ReactNode | — | |
| endIcon | ReactNode | — |
CompactButton
extends Omit< ComponentPropsWithoutRef<'button'>, 'color' | 'children' >
Varyant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| appearance | stroke | ghost | white | error | inherit | stroke | |
| size | lg | md | lg | |
| fullRadius | boolean | false | Pill instead of a rounded square. |
Diğer proplar
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| children* | ReactNode | — | The glyph. Required — this control is always icon-only. |
| disabled | boolean | — | |
| required | boolean | — | |
| readOnly | boolean | — | |
| value | string | — | |
| defaultValue | string | — | |
| name | string | — | |
| aria-label* | string | — | Accessible name. Required, not optional: a button whose only content is an SVG has no accessible name at all, so the type system asks for one. |
FancyButton
extends Omit< ComponentPropsWithoutRef<'button'>, 'color' >
Varyant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| color | neutral | primary | error | success | basic | primary | Figma `🧩 Type` — Neutral · Primary · Error · Success · Basic. |
| size | md | sm | xs | md | Figma `📏 Size` — Medium (40) · Small (36) · X-Small (32). |
| fullWidth | boolean | false |
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 | — | |
| startIcon | ReactNode | — | |
| endIcon | ReactNode | — | |
| asChild | boolean | false |
LinkButton
extends Omit< ComponentPropsWithoutRef<'a'>, 'color' >
Varyant eksenleri — bileşenin cva tanımından
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| color | gray | black | primary | error | success | inherit | gray | |
| size | md | sm | md | |
| underline | boolean | false |
Diğer proplar
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| children | ReactNode | — | |
| aria-label | string | — | |
| startIcon | ReactNode | — | |
| endIcon | ReactNode | — | |
| disabled | boolean | — | |
| asChild | boolean | false | Render the child element instead of an `<a>` — for router links. |