بطاقة
سطح لمحتوى يجمعه موضوع واحد، باستدارة أكبر من استدارة عنصر التحكم كي لا تبدو البطاقة زرًا أبدًا.
server - 0 KB
بطاقة
server - 0 KBسطح لمحتوى يجمعه موضوع واحد، باستدارة أكبر من استدارة عنصر التحكم كي لا تبدو البطاقة زرًا أبدًا.
Storage
You have used 18 GB of the 50 GB in your plan.
الشيفرة
card.tsx
import { CardBody, CardHeader, CardRoot } from 'topclassui/card'
/** The first drawing: a title and a line of text, with nothing to press. */
export default function Demo() {
return (
<div className="max-w-xs">
<CardRoot>
<CardHeader>
<h2>Storage</h2>
</CardHeader>
<CardBody>You have used 18 GB of the 50 GB in your plan.</CardBody>
</CardRoot>
</div>
)
}
تحدد البطاقة خط عنوانها وتترك لك مستوى العنوان: ضع h2 أو h3 داخل CardHeader.
كل الحالات، بدون تمرير الفأرة
3 حالاتStorage
You have used 18 GB of the 50 GB in your plan.
Version 0.4
Card is now CardRoot. Find and replace; nothing else changed.
Loading
أو استورده من الحزمة
topclassui/card
import { CardRoot, CardHeader, CardBody, CardFooter, CardSkeleton } from 'topclassui/card'ثبّت مرة واحدة:npm i topclassui@beta zod
أمثلة
- كل جزء مُصدَّر باسم مستقل:
CardRootوCardHeaderوCardBodyوCardFooterوCardSkeleton. لا يوجدCard. - البطاقة نفسها ليست تفاعلية؛ ما يمكن للمستخدم فعله يوضع في
CardFooterعلى شكلButton، في صف يلتف حين تضيق البطاقة. CardBodyعنصر كتلي، فباعد بين الفقرات المتعددة بنفسك، مثلًا بـspace-y-2.- تأخذ البطاقة عرض حاويتها: في الشبكة تملأ كل بطاقة خليتها وارتفاع صفها.
CardSkeletonيحجز العرض كاملًا بنسبة 5:2 أثناء تحميل البيانات؛ مرّر الارتفاع الحقيقي فيclassName.
basic
Storage
You have used 18 GB of the 50 GB in your plan.
basic.tsx
import { CardBody, CardHeader, CardRoot } from 'topclassui/card'
/** The first drawing: a title and a line of text, with nothing to press. */
export default function Demo() {
return (
<div className="max-w-xs">
<CardRoot>
<CardHeader>
<h2>Storage</h2>
</CardHeader>
<CardBody>You have used 18 GB of the 50 GB in your plan.</CardBody>
</CardRoot>
</div>
)
}
with-actions
Version 0.4
Card is now CardRoot. Find and replace; nothing else changed.
with-actions.tsx
import { Button } from 'topclassui/button'
import { CardBody, CardFooter, CardHeader, CardRoot } from 'topclassui/card'
/** The second drawing: a solid and an outline small button in the footer. */
export default function Demo() {
return (
<div className="max-w-xs">
<CardRoot>
<CardHeader>
<h2>Version 0.4</h2>
</CardHeader>
<CardBody>Card is now CardRoot. Find and replace; nothing else changed.</CardBody>
<CardFooter>
<Button size="sm">Read more</Button>
<Button size="sm" variant="outline" tone="neutral">Later</Button>
</CardFooter>
</CardRoot>
</div>
)
}
report
report.tsx
import { Button } from 'topclassui/button'
import { CardBody, CardFooter, CardHeader, CardRoot } from 'topclassui/card'
/** The docs code sample, with the download as a real link that keeps the button look. */
export default function Demo() {
return (
<div className="max-w-xs">
<CardRoot>
<CardHeader>
<h2>Monthly report</h2>
</CardHeader>
<CardBody>Revenue rose 12% against April, driven by renewals.</CardBody>
<CardFooter>
<Button render={<a href="/reports/may.pdf" />} variant="outline" size="sm">
Download PDF
</Button>
</CardFooter>
</CardRoot>
</div>
)
}
paragraphs
Before you migrate
Export your projects first. The archive keeps every file and its history.
Invitations that are still pending do not move, so send them again afterwards.
paragraphs.tsx
import { CardBody, CardHeader, CardRoot } from 'topclassui/card'
/** CardBody is a block, so the caller spaces several paragraphs, here with space-y-2. */
export default function Demo() {
return (
<div className="max-w-sm">
<CardRoot>
<CardHeader>
<h2>Before you migrate</h2>
</CardHeader>
<CardBody className="space-y-2">
<p>Export your projects first. The archive keeps every file and its history.</p>
<p>Invitations that are still pending do not move, so send them again afterwards.</p>
</CardBody>
</CardRoot>
</div>
)
}
grid
Starter
One project and 5 GB of storage.
Team
Ten projects, 50 GB of storage and a shared library for the whole team.
Business
Unlimited projects and single sign-on.
grid.tsx
import { CardBody, CardHeader, CardRoot } from 'topclassui/card'
/** Three cards in a grid: each takes the width of its cell and the height of its row. */
export default function Demo() {
return (
<div className="grid gap-4 sm:grid-cols-3">
<CardRoot>
<CardHeader>
<h2>Starter</h2>
</CardHeader>
<CardBody>One project and 5 GB of storage.</CardBody>
</CardRoot>
<CardRoot>
<CardHeader>
<h2>Team</h2>
</CardHeader>
<CardBody>Ten projects, 50 GB of storage and a shared library for the whole team.</CardBody>
</CardRoot>
<CardRoot>
<CardHeader>
<h2>Business</h2>
</CardHeader>
<CardBody>Unlimited projects and single sign-on.</CardBody>
</CardRoot>
</div>
)
}
skeleton
Storage
You have used 18 GB of the 50 GB in your plan.
skeleton.tsx
import { CardBody, CardHeader, CardRoot, CardSkeleton } from 'topclassui/card'
/** The skeleton at its default 5:2, then one given h-36 above a real card of that height. */
export default function Demo() {
return (
<div className="flex max-w-xs flex-col gap-4">
<CardSkeleton />
<CardSkeleton className="h-36" />
<CardRoot className="h-36">
<CardHeader>
<h2>Storage</h2>
</CardHeader>
<CardBody>You have used 18 GB of the 50 GB in your plan.</CardBody>
</CardRoot>
</div>
)
}
بالعربية، من اليمين إلى اليسار
التقرير الشهري
ارتفعت الإيرادات 12% مقارنة بشهر أبريل، بفضل التجديدات.
rtl.tsx
import { Button } from 'topclassui/button'
import { CardBody, CardFooter, CardHeader, CardRoot } from 'topclassui/card'
export default function Demo() {
return (
<div dir="rtl" lang="ar" className="max-w-xs">
<CardRoot>
<CardHeader>
<h2>التقرير الشهري</h2>
</CardHeader>
<CardBody>ارتفعت الإيرادات 12% مقارنة بشهر أبريل، بفضل التجديدات.</CardBody>
<CardFooter>
<Button size="sm">اقرأ المزيد</Button>
<Button size="sm" variant="outline" tone="neutral">لاحقًا</Button>
</CardFooter>
</CardRoot>
</div>
)
}
الخصائص
CardRoot
CardHeader
CardBody
CardFooter
CardSkeleton
لا خصائص خاصة به: يأخذ سمات العنصر الذي يعرضه.
لوحة المفاتيح وإمكانية الوصول
لا شيء يُشغَّل: ليس تفاعليًا بمفرده.
- تُعرض البطاقة عناصر
divعادية بلا دور: ما تحتويه هو ما يمنحها المعنى. - اختر مستوى العنوان الذي يحتاجه مخطط الصفحة؛
CardHeaderينسّق أي عنوان تضعه فيه. CardSkeletonمخفي عن التقنيات المساعدة، فعلِّم المنطقة التي تُحمَّل نفسها، مثلًا بـaria-busy.
من اليمين إلى اليسار
تبدأ أزرار التذييل من بداية السطر، فيقع أولها في العربية على اليمين؛ ويُحاذى النص إلى البداية.
الخادم والمتصفح
يُعرض على الخادم ولا يرسل أي JavaScript.
الملفات: index.tsx.
على الشارة: server - 0 KB.