انتقل إلى المحتوى
TopClass UI

خط زمني

مسار من الأحداث المؤرّخة، لكل حدث علامة بنبرته. يُعرض على الخادم وينعكس وحده في التخطيطات من اليمين إلى اليسار.

server - 0 KB

خط زمني

server - 0 KB

مسار من الأحداث المؤرّخة، لكل حدث علامة بنبرته. يُعرض على الخادم وينعكس وحده في التخطيطات من اليمين إلى اليسار.

تثبيت
  1. Done
    Project created
  2. Done
    First deploy
  3. Current
    In review
    Today
  4. Not started
    Launch
    Not scheduled

الشيفرة

timeline.tsx
import { Timeline } from 'topclassui/timeline'

const EVENTS = [
  { id: 'created', title: 'Project created', time: <time dateTime="2026-10-02T09:12">2 October, 09:12</time>, status: 'done' },
  { id: 'deployed', title: 'First deploy', time: <time dateTime="2026-10-04T16:40">4 October, 16:40</time>, status: 'done' },
  { id: 'review', title: 'In review', time: 'Today', status: 'current' },
  { id: 'launch', title: 'Launch', time: 'Not scheduled', status: 'todo' },
] as const

/** The drawn rail: done filled in success, the current step a dot in a ring, and a hollow todo.
 * A `<time>` gives a date a machine can read; each status is also said in hidden text. */
export default function Demo() {
  return <Timeline items={EVENTS} getKey={(event) => event.id} />
}

أيقونة العنصر عنصرٌ، مثل <Svg icon={check} size="xs" />، لا اسم أيقونة: لا يُشحن أي محمّل أيقونات.

كل الحالات، بدون تمرير الفأرة

6 حالات
  1. Done
    Done
    A filled dot in success
  1. Current
    Current
    A dot in a ring, read as the current step
  1. Not started
    To do
    A hollow dot
  1. A tone of its own
    No status, the danger tone
  1. Done
    An icon
    Takes the tone of its status
  1. Not started
    An icon to do

أو استورده من الحزمة

topclassui/timeline
import { Timeline } from 'topclassui/timeline'

ثبّت مرة واحدة:npm i topclassui@beta zod

أمثلة

  • العنصر هو { title, time?, status?, tone?, icon? }، وأي حقل خاص بك، مثل id لـ getKey.
  • مرّر <time dateTime="..."> في time لتاريخ تقرؤه الآلة، ويظهر باهتًا تحت العنوان.
  • العنصر done نقطة ممتلئة، وcurrent نقطة داخل حلقة، وtodo نقطة مفرّغة. بلا نبرة يكون done بنبرة success والبقية بنبرة primary، وتبقى علامة todo مفرّغة أيًّا كانت النبرة.
  • يعرض الخط الزمني items كما تصله وبترتيبها: لا يرتّب ولا يجلب البيانات ولا يقسّمها إلى صفحات.
  • عند غياب العناصر يُعرض emptyFallback وحده، أو لا شيء إن لم يُمرَّر.
basic
  1. Done
    Project created
  2. Done
    First deploy
  3. Current
    In review
    Today
  4. Not started
    Launch
    Not scheduled
tones
  1. Primary
    A new version is ready.
  2. Neutral
    Nothing has changed since Monday.
  3. Success
    The invoice was paid.
  4. Warning
    The trial ends in three days.
  5. Danger
    The last deploy failed.
  6. Info
    Maintenance starts at 22:00.
icons
  1. Invoice created
    09:12
  2. Payment received
    11:30
  3. Receipt delayed
    11:31
  4. Not started
    Receipt sent
long-text
  1. The deploy failed while uploading the static assets to the edge network
    Friday 9 October 2026 at 16:40, Central European Summer Time
  2. https://example.com/projects/topclassui/deployments/2026-10-09/logs/build-step-four-of-six.txt
    Kept for thirty days
  3. Not started
    Retry
empty

No activity yet.

بالعربية، من اليمين إلى اليسار
  1. مكتمل
    أُنشئ المشروع
    ٢ أكتوبر، ٠٩:١٢
  2. مكتمل
    وصلت الدفعة
    ٤ أكتوبر، ١٦:٤٠
  3. الحالي
    قيد المراجعة
    اليوم
  4. لم يبدأ
    الإطلاق
    لم يُحدَّد موعده

الخصائص

خصائص Timeline
الخاصيةالنوعالافتراضيالحدودالوصف
getKey*(item: T) => string--A stable identity for each item, which becomes its React key.
items*readonly T[]--The events, first to last. The connector runs from each marker to the next.
emptyFallbackReactNode--Rendered in place of the list while items is empty. Without it, nothing renders.
labelsLabels--The built-in strings, which name each status. Defaults to English; pass getLabels(locale).labels for another.
localestring--Accepted so {...getLabels(locale)} spreads cleanly. Nothing here formats a number, so it is not used and never reaches the element.

لوحة المفاتيح وإمكانية الوصول

لا شيء يُشغَّل: ليس تفاعليًا بمفرده.

  • قائمة مرتّبة، مع role="list" مكتوبًا كي يحتفظ بها Safari مع VoiceOver.
  • العلامة شكل ولون، فتُقال كل حالة أيضًا بكلمات مخفية من labels، والعنصر الحالي يحمل aria-current="step".
  • لا شيء فيه يأخذ التركيز: هو محتوى الصفحة، لا عنصر تحكم.

من اليمين إلى اليسار

يقع المسار في بداية السطر، على اليمين في العربية، بلا خاصية اتجاه. مرّر labels لتُقال كلمات الحالات بالعربية.

الخادم والمتصفح

يُعرض على الخادم ولا يرسل أي JavaScript.

الملفات: index.tsx.

على الشارة: server - 0 KB.