TNRR Design System
เอกสารอ้างอิงรวม design token, typography, component และ pattern ที่ใช้ใน TNRR AI Portal. ค่าทั้งหมดอ้างอิงจาก app/globals.css และ components/ui/* — ไม่ใช่คู่มือผู้ใช้ แต่สำหรับทีม designer + engineer.
Overview
Ocean-blue brand + Teal AI accent + Coral warm tone — tokens ประกาศใน @theme เป็น CSS-first; Tailwind v4 ไม่มี config file แยก
3 palette หลักสื่อสาร trust (ocean), AI (teal), action (coral) — semantic mapping ซ้อนทับ shadcn tokens
IBM Plex Sans Thai เป็น font ลำดับแรกใน :lang(th) + Inter สำหรับ Latin; fallback Noto Sans Thai
Components ทั้งหมดใน components/ui/ ใช้ @base-ui/react + class-variance-authority — มี TNRR variants เพิ่มจาก shadcn ต้นฉบับ
app/globals.css (@theme tokens) + spec/v3/01_DESIGN_SYSTEM.mdColor tokens
คลิก swatch เพื่อคัดลอกค่า hex
Primary · Ocean Blue
brandTeal · AI accent
AICoral · Warm accent
Amber · Soft
Semantic
Neutral · Ink
Semantic mapping
shadcn-style tokens ที่ใช้กับ bg-primary, text-accent, border-border ฯลฯ — ค่าเปลี่ยนตาม theme
| Token | Light | Dark |
|---|---|---|
| --primary | #1E5C8A | #5FADE0 |
| --secondary | #EFF6FB | #1C1C20 |
| --accent | #EEFDFB | #086F68 |
| --muted | #F0F1F3 | #27272A |
| --border | #E4E4E7 | #27272A |
| --ring | #14B8B0 | #3DD4CB |
| --destructive | #DC2626 | #F87171 |
| --chart-1 | #1E5C8A | #1E5C8A |
| --chart-2 | #0EA5A0 | #0EA5A0 |
| --chart-3 | #E8734A | #E8734A |
| --chart-4 | #F5B342 | #F5B342 |
| --chart-5 | #7C3AED | #7C3AED |
Typography
ลองเปลี่ยนข้อความตัวอย่างด้านบนเพื่อเห็นสัดส่วนจริง
--font-sans--font-display--font-mono| Utility | Preview |
|---|---|
text-display-xl | คลังข้อมูลงานวิจัย Thai National Research Repository |
text-display-lg | คลังข้อมูลงานวิจัย Thai National Research Repository |
text-display-md | คลังข้อมูลงานวิจัย Thai National Research Repository |
text-heading-lg | คลังข้อมูลงานวิจัย Thai National Research Repository |
text-heading-md | คลังข้อมูลงานวิจัย Thai National Research Repository |
text-heading-sm | คลังข้อมูลงานวิจัย Thai National Research Repository |
text-body-lg | คลังข้อมูลงานวิจัย Thai National Research Repository |
text-body-mdbody default | คลังข้อมูลงานวิจัย Thai National Research Repository |
text-body-sm | คลังข้อมูลงานวิจัย Thai National Research Repository |
text-caption | คลังข้อมูลงานวิจัย Thai National Research Repository |
text-overlineuppercase | คลังข้อมูลงานวิจัย Thai National Research Repository |
Radii
ค่า radius ทั้ง 8 — ใช้ rounded-xs ถึง rounded-full เป็น Tailwind utility
Shadows
ใช้ Tailwind utility shadow-xs..xl — มี token ambient shadow-glow (teal) และ shadow-cardh
Gradients
ใช้กับ hero, AI accent, stat card และ navbar top bar
--gradient-hero--gradient-ai--gradient-ai-button--gradient-accent-bar--gradient-stat--gradient-card-glowAnimations
3 animation หลักที่ใช้ทั่วแอป — คลิก Replay เพื่อดูอีกครั้ง
animate-fade-upshimmerstreaming-cursorIcons
Icon set กลางทั้งหมดมาจาก lucide-react — import ตัวที่ใช้เท่านั้น ห้าม import ทั้ง library
FlaskConicalSparklesSearchBellBarChart3MapHomeMessageSquareLayersNetworkFileTextUserCalendarClockFilterSettingsPlusEdit3Trash2DownloadCopyCheckMoreHorizontalChevronDownChevronRightArrowRightArrowLeftMenuXBadges
17 variants รวม TNRR pill tones (topic / ai / status / keyword ฯลฯ)
<Badge variant="topic" size="md">
Climate change
</Badge>Form controls
Primitive สำหรับ field — ทั้งหมดรองรับ dark mode และ focus ring
Data display
Card / Tabs / Accordion / Progress / Skeleton / Separator / Avatar
Overlays
Dialog / Sheet / Popover / DropdownMenu — คลิก trigger เพื่อเปิดจริง
Charts palette
Recharts ไม่อ่าน CSS var ต้อง pass สีเป็น prop — ใช้ useTheme().resolvedTheme สลับ palette
chart-1chart-2chart-3chart-4chart-5Recharts default tooltip เป็นสีขาว — override contentStyle สำหรับ dark mode
Leaflet heatmap / force-graph canvas ก็ไม่อ่าน CSS var เช่นกัน
Responsive
Tailwind v4 default breakpoints — pattern ที่ใช้จริงในแอป
| BP | Min width | Note |
|---|---|---|
| sm | 640px | โทรศัพท์แนวนอน / tablet เล็ก |
| md | 768px | tablet — sidebar/filter แสดงได้ |
| lg | 1024px | desktop — navbar เต็มพร้อม tab row |
| xl | 1280px | desktop กว้าง — chart grid 3-col |
px-4 lg:px-6 max-w-[1440px] mx-autoclassName="hidden lg:block"<lg: hamburger → Sheet drawer<md: Sheet slide-in ≥md: inline <aside>lg:hidden fixed bottom-5 right-5 z-30grid-cols-1 md:grid-cols-2 xl:grid-cols-3อัปเดตเมื่อ design tokens เปลี่ยน — ไฟล์ข้อมูลใน app/design-system/page.tsx ต้อง sync กับ app/globals.css ด้วยมือ.