Skip to content

Design Tokens

デザイントークンは、デザインシステムにおける最小単位の設計値です。色、フォントサイズ、スペーシングなど、UI を構成する基本的な値を一元管理します。

  • 一貫性: アプリケーション全体でデザインの統一を保証
  • メンテナンス性: 値の変更が一箇所で完結
  • コミュニケーション: デザイナーとエンジニア間の共通言語

このプロジェクトでは MUI の createTheme を使用してトークンをテーマオブジェクトとして定義しています。

tokens/theme.ts
import { createTheme } from "@mui/material/styles";
export const theme = createTheme({
palette: {
primary: {
main: "#2563eb",
light: "#60a5fa",
dark: "#1e40af",
},
success: { main: "#16a34a" },
warning: { main: "#d97706" },
error: { main: "#dc2626" },
},
typography: {
fontFamily: "'Inter', sans-serif",
},
spacing: 4, // base 4px
shape: { borderRadius: 6 },
});

MUI テーマオブジェクトは ThemeProvider 経由で全コンポーネントに自動的に提供されます。

カテゴリMUI テーマフィールド
Colorspaletteprimary, grey, success, warning, error
Spacingspacing4px ベース (spacing(1)=4px, spacing(2)=8px…)
TypographytypographyfontFamily, fontWeight
ShapeshapeborderRadius
Component OverridescomponentsMuiButton の styleOverrides