EmptyState
نمای کلیimport { EmptyState } from '@nili/ui';این همان صفحهی نمای کلیِ خود کتابخانه است که زنده رندر میشود. زبان یا تم را از هدر عوض کنید، همراهش میآید.
پایه
فقط title الزامی است. اسلات illustration اندازهی هر SVG یا تصویری را که بدهید از محور size میگیرد، پس خود آیکون را بدهید نه چیزی که قاب دورش میکشد — تصویرسازی در فیگما میماند و اکسپورت میشود، نه اینکه کامپوننت آن را همراه ببرد.
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>}
/>
)
}اندازهها
سه چگالی. sm برای یک سلول خالی یا پنل باریک، md برای کارت، lg برای یک صفحهی کامل.
عبارت دیگری را جستوجو کنید.
عبارت دیگری را جستوجو کنید.
عبارت دیگری را جستوجو کنید.
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" />
</>
)
}سه حالتی که ارزش تفکیک دارند
«هنوز چیزی ساخته نشده»، «چیزی پیدا نشد» و «خطایی رخ داد» سه وضعیت متفاوتاند و کنش هرکدام فرق میکند. حالت «نتیجهای نیست» که دکمهی «اولین مورد را بسازید» میدهد گیجکننده است؛ موردها وجود دارند، فیلتر اشتباه است.
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' >
بقیهی پراپها
| پراپ | نوع | پیشفرض | توضیح |
|---|---|---|---|
| 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 |