StackUI

Design Tokens

ตัวแปร CSS ทั้งหมดที่ใช้ใน StackUI — synced จาก Figma Variables

Design tokens ทั้งหมดของ StackUI ถูก sync มาจาก Figma Variables โดยใช้ script figma-to-css.ts เป็น single source of truth

Source of Truth

Figma Variables → Variables_Figma/*.json → bun run sync:figma → packages/design-tokens/*.css

ทุกครั้งที่แก้ design ใน Figma ให้ export JSON แล้วรัน bun run sync:figma เพื่อ sync CSS


Typography

Font Families

VariableFontใช้กับ
--stk-font-primaryInterHeading
--stk-font-secondaryIBM Plex Sans ThaiBody text
--stk-font-tertiarySarabunข้อความเสริม
--stk-font-heading= --stk-font-primaryh1–h6
--stk-font-body= --stk-font-secondarybody
--stk-font-monoJetBrains Monocode

Font Sizes (16 ระดับ)

:root {  --stk-text-10px: 10px;  --stk-text-12px: 12px;  --stk-text-14px: 14px;  --stk-text-16px: 16px;  --stk-text-18px: 18px;  --stk-text-20px: 20px;  --stk-text-22px: 22px;  --stk-text-24px: 24px;  --stk-text-26px: 26px;  --stk-text-32px: 32px;  --stk-text-40px: 40px;  --stk-text-44px: 44px;  --stk-text-48px: 48px;  --stk-text-56px: 56px;  --stk-text-64px: 64px;  --stk-text-72px: 72px;}

Font Weights (9 ระดับ)

VariableValueชื่อ
--stk-font-thin100Thin
--stk-font-extra-light200Extra Light
--stk-font-light300Light
--stk-font-regular400Regular
--stk-font-medium500Medium
--stk-font-semibold600Semibold
--stk-font-bold700Bold
--stk-font-extra-bold800Extra Bold
--stk-font-black900Black

Colors

Color Palette (22 กลุ่ม × 11 shades = 240 สี)

ใช้ format: --stk-{color}-{shade}

กลุ่มสีที่มี: amber, blue, cyan, emerald, fuchsia, gray, green, indigo, lime, neutral, orange, pink, purple, red, rose, sky, slate, stone, teal, violet, yellow, zinc

Shades: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950

:root {  --stk-blue-50:  #eff6ff;  --stk-blue-100: #dbeafe;  --stk-blue-200: #bedbff;  --stk-blue-300: #8ec5ff;  --stk-blue-400: #51a2ff;  --stk-blue-500: #2b7fff;  --stk-blue-600: #155dfc;  --stk-blue-700: #1447e6;  --stk-blue-800: #193cb8;  --stk-blue-900: #1c398e;  --stk-blue-950: #162456;}

Semantic Colors

Semantic colors ถูก map จาก palette — brand presets สามารถ override ได้

VariableMapped จากใช้กับ
--stk-primaryblue-700สีหลักของ brand
--stk-primary-lightblue-500สีหลัก (อ่อน)
--stk-primary-darkblue-900สีหลัก (เข้ม)
--stk-secondaryamber-400สีรอง
--stk-secondary-lightamber-300สีรอง (อ่อน)
--stk-secondary-darkamber-600สีรอง (เข้ม)
--stk-accentemerald-500สีเน้น
--stk-successemerald-500สำเร็จ
--stk-warningamber-500เตือน
--stk-dangerred-500อันตราย
--stk-infoblue-500ข้อมูล

Background & Text

Variableค่าใช้กับ
--stk-bg-primarywhiteพื้นหลังหลัก
--stk-bg-secondarygray-50พื้นหลังรอง
--stk-bg-altgray-100พื้นหลังสลับ
--stk-bg-darkgray-900พื้นหลังมืด
--stk-text-primarygray-900ข้อความหลัก
--stk-text-secondarygray-600ข้อความรอง
--stk-text-mutedgray-400ข้อความจาง
--stk-text-inversewhiteข้อความบนพื้นมืด

Spacing

Spacing Scale (15 ค่า)

:root {  --stk-space-0:  0px;  --stk-space-2:  2px;  --stk-space-4:  4px;  --stk-space-8:  8px;  --stk-space-10: 10px;  --stk-space-12: 12px;  --stk-space-16: 16px;  --stk-space-20: 20px;  --stk-space-24: 24px;  --stk-space-32: 32px;  --stk-space-40: 40px;  --stk-space-48: 48px;  --stk-space-56: 56px;  --stk-space-64: 64px;  --stk-space-72: 72px;  /* Negative */  --stk-space-neg-8:  -8px;  --stk-space-neg-16: -16px;  /* Section */  --stk-section-py:    var(--stk-space-64);  --stk-section-py-sm: var(--stk-space-40);  /* Container */  --stk-container-max: 1200px;  --stk-container-px:  var(--stk-space-24);}

Border Radius (19 ค่า)

:root {  --stk-radius-0:    0px;  --stk-radius-2:    2px;  --stk-radius-4:    4px;  --stk-radius-6:    6px;  --stk-radius-8:    8px;  --stk-radius-10:   10px;  --stk-radius-12:   12px;  --stk-radius-14:   14px;  --stk-radius-16:   16px;  --stk-radius-20:   20px;  --stk-radius-24:   24px;  --stk-radius-32:   32px;  --stk-radius-40:   40px;  --stk-radius-48:   48px;  --stk-radius-56:   56px;  --stk-radius-64:   64px;  --stk-radius-72:   72px;  --stk-radius-full: 999px;}

Border Widths

VariableValue
--stk-border-11px
--stk-border-22px
--stk-border-44px
--stk-border-88px
--stk-border-1212px
--stk-border-1616px

Shadows

Variableใช้กับ
--stk-shadow-smเงาเบาๆ (hover state)
--stk-shadow-mdcard, dropdown
--stk-shadow-lgmodal, popover
--stk-shadow-xlfloating elements

Utility Classes

/* Section */.stk-section              /* section padding (64px) */.stk-section--sm          /* smaller padding (40px) */.stk-section--dark        /* dark background */.stk-section--gray        /* gray background *//* Text */.stk-heading              /* heading style */.stk-subheading           /* subheading style */.stk-text-primary         /* primary color text */.stk-text-secondary       /* secondary color text */.stk-text-muted           /* muted color text *//* Button */.stk-btn                  /* button base */.stk-btn--primary         /* primary button */.stk-btn--secondary       /* secondary button */.stk-btn--outline         /* outline button *//* Card */.stk-card                 /* card with shadow + hover *//* Misc */.stk-divider              /* horizontal line */.stk-img-cover            /* object-fit: cover */.stk-img-contain          /* object-fit: contain */

On this page