EmptyState
Genel görünümimport { EmptyState } 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
Yalnızca title zorunlu. illustration yuvası verdiğiniz SVG veya görselin boyutunu size ekseninden alır; bu yüzden onu çerçeveleyen bir şeyi değil, simgenin kendisini verin — çizimler Figma’da durur ve dışa aktarılır, bileşenle gelmez.
When you send your first invoice, it will show up here.
import { EmptyState, Button, Icon } from "@nili/ui"
import { RiInboxLine, RiAddLine } from "@remixicon/react"
export function Example() {
return (
<EmptyState
illustration={<Icon icon={RiInboxLine} />}
title={t('copy.noInvoices')}
description={t('copy.noInvoicesBody')}
actions={<Button startIcon={<Icon icon={RiAddLine} />}>New invoice</Button>}
/>
)
}Boyutlar
Üç yoğunluk. Boş bir hücre ya da dar panel için sm, kart için md, tüm sayfa için lg.
Başka bir arama terimi deneyin.
Başka bir arama terimi deneyin.
Başka bir arama terimi deneyin.
import { EmptyState } from "@nili/ui"
export function Example() {
return (
<>
<EmptyState size="sm" title={t('copy.noResults')} />
<EmptyState size="md" title="No results" />
<EmptyState size="lg" title="No results" />
</>
)
}Ayırmaya değer üç durum
“Henüz bir şey oluşturulmadı”, “eşleşen bir şey yok” ve “bir şeyler ters gitti” farklı durumlardır ve her birinde eylem değişir. “Sonuç yok” durumunda “İlk öğeni oluştur” demek kafa karıştırır — öğeler var, yanlış olan filtredir.
Create one to get started.
Check the spelling, or clear the filters.
Check your connection and try again.
import { EmptyState, Button, LinkButton, Icon } from "@nili/ui"
import { RiInboxLine, RiSearchLine, RiWifiOffLine } from "@remixicon/react"
export function Example() {
return (
<>
{/* nothing created yet → offer to create */}
<EmptyState
illustration={<Icon icon={RiInboxLine} />}
title={t('copy.noProjects')}
description={t('copy.noProjectsBody')}
actions={<Button>New project</Button>}
/>
{/* nothing matched → offer to clear the filter */}
<EmptyState
illustration={<Icon icon={RiSearchLine} />}
title="No projects match “roadmap”"
description={t('copy.noMatchesBody')}
actions={<Button appearance="stroke">Clear filters</Button>}
/>
{/* something failed → offer to retry */}
<EmptyState
illustration={<Icon icon={RiWifiOffLine} />}
title={t('copy.loadFailed')}
description={t('copy.loadFailedBody')}
actions={
<>
<Button appearance="stroke">Retry</Button>
<LinkButton href="#">Contact support</LinkButton>
</>
}
/>
</>
)
}EmptyState
extends Omit< ComponentPropsWithoutRef<'div'>, 'title' >
Diğer proplar
| Prop | Tip | Varsayılan | Notlar |
|---|---|---|---|
| children | ReactNode | — | |
| aria-label | string | — | |
| illustration | ReactNode | — | SVG exported from the Figma Empty States page, or any node. |
| title* | ReactNode | — | |
| description | ReactNode | — | |
| actions | ReactNode | — | One or two buttons. |
| size | lg | md | sm | md |