مؤشر التحميل
للانتظار مجهول المدة. مؤشر التحميل أيقونة، فيأخذ أحجام الأيقونات من 16 إلى 40 بكسل، ويمكنه أن يتبع النص الذي يجلس فيه.
server - 0 KB
مؤشر التحميل
server - 0 KBللانتظار مجهول المدة. مؤشر التحميل أيقونة، فيأخذ أحجام الأيقونات من 16 إلى 40 بكسل، ويمكنه أن يتبع النص الذي يجلس فيه.
جرّبه
size
tone
الشيفرة
spinner.tsx
import { Spinner } from 'topclassui/spinner'
<Spinner />فضّل Skeleton عندما يكون شكل القادم معروفًا؛ مؤشر التحميل للانتظار المجهول.
كل الحالات، بدون تمرير الفأرة
3 حالاتDecorative, in the text colour
أو استورده من الحزمة
topclassui/spinner
import { Spinner } from 'topclassui/spinner'ثبّت مرة واحدة:npm i topclassui@beta zod
أمثلة
- لمسار ما زال يُحمَّل أو معاينة ما زالت تُبنى. وعندما يكون شكل القادم معروفًا، كقائمة أو جدول، يحفظ Skeleton مكانه بدلًا منه.
size="custom"لا يضع حجمًا، فيكون المؤشر بحجم 1em ويكبر مع النص المحيط به.- لتأخذ لون النص المحيط بدل
tone، مرّرclassName="text-current".
with-text
Building your preview
with-text.tsx
import { Spinner } from 'topclassui/spinner'
/** The docs sample, a route-level loading fallback: the text names the wait, so the spinner is hidden. */
export default function Demo() {
return (
<div className="flex items-center justify-center gap-3 py-16">
<Spinner size="lg" aria-hidden />
<p className="text-muted">Building your preview</p>
</div>
)
}
sizes
sizes.tsx
import { Spinner } from 'topclassui/spinner'
/** The five icon steps, 16 to 40 px, each named "Loading" by default. */
export default function Demo() {
return (
<div className="flex flex-wrap items-center gap-3">
<Spinner size="xs" />
<Spinner size="sm" />
<Spinner size="md" />
<Spinner size="lg" />
<Spinner size="xl" />
</div>
)
}
tones
tones.tsx
import { Spinner } from 'topclassui/spinner'
/** Each of the six tones at the default size, drawn in the tone's on-soft colour. */
export default function Demo() {
return (
<div className="flex flex-wrap items-center gap-3">
<Spinner tone="primary" />
<Spinner tone="neutral" />
<Spinner tone="success" />
<Spinner tone="warning" />
<Spinner tone="danger" />
<Spinner tone="info" />
</div>
)
}
inherit-color
Retrying the payment
Saving the draft
inherit-color.tsx
import { Spinner } from 'topclassui/spinner'
/** text-current replaces the tone, so each spinner takes the colour of the line it sits in. */
export default function Demo() {
return (
<div className="flex flex-col gap-3">
<p className="flex items-center gap-2 rounded-box bg-danger-soft p-3 text-danger-on-soft">
<Spinner size="sm" className="text-current" aria-hidden />
Retrying the payment
</p>
<p className="flex items-center gap-2 text-muted">
<Spinner size="sm" className="text-current" aria-hidden />
Saving the draft
</p>
</div>
)
}
custom-size
Syncing at text-sm
Syncing at text-lg
Syncing at text-3xl
custom-size.tsx
import { Spinner } from 'topclassui/spinner'
/** custom sets no size, so each spinner is 1em and grows with the type step around it. */
export default function Demo() {
return (
<div className="flex flex-col gap-3 text-body">
<p className="flex items-center gap-2 text-sm">
<Spinner size="custom" aria-hidden />
Syncing at text-sm
</p>
<p className="flex items-center gap-2 text-lg">
<Spinner size="custom" aria-hidden />
Syncing at text-lg
</p>
<p className="flex items-center gap-2 text-3xl">
<Spinner size="custom" aria-hidden />
Syncing at text-3xl
</p>
</div>
)
}
بالعربية، من اليمين إلى اليسار
جارٍ تحميل المعاينة
rtl.tsx
import { ar } from 'topclassui/labels/ar'
import { Spinner } from 'topclassui/spinner'
/** The Arabic labels name the first three; the last sits beside its own text, so it is hidden. */
export default function Demo() {
return (
<div dir="rtl" lang="ar" className="flex flex-col gap-3">
<div className="flex flex-wrap items-center gap-3">
<Spinner labels={ar} size="sm" />
<Spinner labels={ar} />
<Spinner labels={ar} size="lg" tone="neutral" />
</div>
<p className="flex items-center gap-2 text-body">
<Spinner size="sm" aria-hidden />
جارٍ تحميل المعاينة
</p>
</div>
)
}
الخصائص
لوحة المفاتيح وإمكانية الوصول
لا شيء يُشغَّل: ليس تفاعليًا بمفرده.
- له اسم لكنه صامت: صورة اسمها
labels.common.loading، أوaria-labelخاص بك، بلا منطقة حية. - بجانب نص يسمّي الانتظار أصلًا، مرّر
aria-hiddenكي لا يُقرأ الانتظار مرتين. - تحت الألوان القسرية يأخذ لون نص النظام من عنصره الأب، فيبقى ظاهرًا في التباين العالي في Windows، وتقليل الحركة يوقف الدوران.
من اليمين إلى اليسار
الدائرة تدور في الاتجاه نفسه في الاتجاهين ولا تُعكس أبدًا. ومع التسميات العربية يصبح اسمها الافتراضي عربيًا أيضًا.
الخادم والمتصفح
يُعرض على الخادم ولا يرسل أي JavaScript.
الملفات: index.tsx.
على الشارة: server - 0 KB.