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 |