الحالة الفارغة
ما تعرضه القائمة أو الجدول أو البحث حين لا يوجد ما يُعرض: أيقونة وسطر وجملة وإجراء من عندك.
server - 0 KB
الحالة الفارغة
server - 0 KBما تعرضه القائمة أو الجدول أو البحث حين لا يوجد ما يُعرض: أيقونة وسطر وجملة وإجراء من عندك.
Nothing here yet
When there is something to show, it will appear here.
الشيفرة
empty-state.tsx
import { EmptyState } from 'topclassui/empty-state'
/** No props at all: the tray icon, then the English title and description from labels. */
export default function Demo() {
return (
<div className="max-w-85">
<EmptyState />
</div>
)
}
بلا خصائص يعرض أيقونة الدُّرج ونصّي labels.state؛ وعنوانك الخاص يُسقط الوصف الافتراضي.
كل الحالات، بدون تمرير الفأرة
5 حالاتNothing here yet
When there is something to show, it will appear here.
Title only
With action
The action is the caller's own Button.
Failed
Check your connection, then try again.
Filtered
Nothing matches that search.
أو استورده من الحزمة
topclassui/empty-state
import { EmptyState } from 'topclassui/empty-state'ثبّت مرة واحدة:npm i topclassui@beta zod
أمثلة
- مرّر
titleفيذهب الوصف الافتراضي معه، لأنه سيصف شيئًا آخر. - القيمة
nullتخفيiconأوtitleأوdescription. - الإجراء زرّك أنت، يُمرَّر في
children؛ المكوّن لا يرسم أي زر من عنده. - البحث بلا نتائج أو القائمة التي فشل تحميلها هي
iconوtitleآخران، لا نمط مختلف.
default
Nothing here yet
When there is something to show, it will appear here.
default.tsx
import { EmptyState } from 'topclassui/empty-state'
/** No props at all: the tray icon, then the English title and description from labels. */
export default function Demo() {
return (
<div className="max-w-85">
<EmptyState />
</div>
)
}
with-action
with-action.tsx
import { plus } from 'topclassui/icons/plus'
import { Svg } from 'topclassui/svg'
import { Button } from 'topclassui/button'
import { EmptyState } from 'topclassui/empty-state'
/** The drawing: a caller's title and description, and a link styled as a small Button. */
export default function Demo() {
return (
<div className="max-w-85">
<EmptyState
title="No projects yet"
description="Create your first project and it will show up here."
>
<Button size="sm" render={<a href="/projects/new" />}>
<Svg icon={plus} />
New project
</Button>
</EmptyState>
</div>
)
}
filtered
No matches
Nothing matches that search. Try fewer words, or clear the filters.
filtered.tsx
import { magnifyingGlass } from 'topclassui/icons/magnifying-glass'
import { Svg } from 'topclassui/svg'
import { Button } from 'topclassui/button'
import { EmptyState } from 'topclassui/empty-state'
/** The filtered cell: another icon and title, not a variant, and a Clear filters button. */
export default function Demo() {
return (
<div className="max-w-85">
<EmptyState
icon={<Svg icon={magnifyingGlass} size="xl" className="text-muted" />}
title="No matches"
description="Nothing matches that search. Try fewer words, or clear the filters."
>
<Button size="sm" variant="outline">Clear filters</Button>
</EmptyState>
</div>
)
}
failed
The invoices did not load
Check your connection, then try again.
failed.tsx
import { warningCircle } from 'topclassui/icons/warning-circle'
import { Svg } from 'topclassui/svg'
import { Button } from 'topclassui/button'
import { EmptyState } from 'topclassui/empty-state'
/** The error cell: the warning icon in the danger colour, and a Try again button. */
export default function Demo() {
return (
<div className="max-w-85">
<EmptyState
icon={<Svg icon={warningCircle} size="xl" className="text-danger-on-soft" />}
title="The invoices did not load"
description="Check your connection, then try again."
>
<Button size="sm" variant="outline">Try again</Button>
</EmptyState>
</div>
)
}
title-only
No comments yet
title-only.tsx
import { EmptyState } from 'topclassui/empty-state'
/** icon={null} hides the icon, and a caller's title with no description shows no description. */
export default function Demo() {
return (
<div className="max-w-85">
<EmptyState icon={null} title="No comments yet" />
</div>
)
}
long-text
Nothing in https://example.com/workspaces/finance/reports/2026/quarterly/archive/unfiled
Files you move into this folder will show up here, newest first.
long-text.tsx
import { EmptyState } from 'topclassui/empty-state'
const PATH = 'https://example.com/workspaces/finance/reports/2026/quarterly/archive/unfiled'
/** A 200 px column: the URL has no space to break at, so wrap-anywhere breaks it inside the box. */
export default function Demo() {
return (
<div className="w-50">
<EmptyState
title={`Nothing in ${PATH}`}
description="Files you move into this folder will show up here, newest first."
/>
</div>
)
}
بالعربية، من اليمين إلى اليسار
rtl.tsx
import { plus } from 'topclassui/icons/plus'
import { ar } from 'topclassui/labels/ar'
import { Svg } from 'topclassui/svg'
import { Button } from 'topclassui/button'
import { EmptyState } from 'topclassui/empty-state'
/** The Arabic labels give the default title and description; the action is the caller's. */
export default function Demo() {
return (
<div dir="rtl" lang="ar" className="max-w-85">
<EmptyState labels={ar}>
<Button size="sm" render={<a href="/projects/new" />}>
<Svg icon={plus} />
مشروع جديد
</Button>
</EmptyState>
</div>
)
}
الخصائص
لوحة المفاتيح وإمكانية الوصول
لا شيء يُشغَّل: ليس تفاعليًا بمفرده.
- بلا دور وبلا منطقة حية: إنه محتوى من الصفحة يُقرأ في مكانه.
- العنوان فقرة لا عنوان قسم، فلا يضيف شيئًا إلى مخطط الصفحة.
- الأيقونة الافتراضية زخرفية وتأخذ اللون الخافت؛ والأيقونة التي تمررها تحتفظ بلونها.
من اليمين إلى اليسار
عمود في المنتصف، فلا شيء يُعكس. ومع التسميات العربية يصبح العنوان والوصف الافتراضيان عربيين.
الخادم والمتصفح
يُعرض على الخادم ولا يرسل أي JavaScript.
الملفات: index.tsx.
على الشارة: server - 0 KB.