AgentSkillsCN

m3-expressive

基于 Material 3 表现力设计系统的 UI 组件实现指南。在新增或修改 UI 组件时,可作为参考依据。

SKILL.md
--- frontmatter
name: m3-expressive
description: Material 3 Expressiveデザインシステムに基づくUIコンポーネントの実装ガイド。新しいUIコンポーネントを追加・修正する際に参照する。

概要

このプロジェクトのUIコンポーネント(apps/subscope/app/components/ui/)はMaterial 3 Expressiveデザインに基づいて実装されている。新しいコンポーネントを追加する際は、このガイドに従って一貫したデザインを維持すること。

M3 Expressiveの5つの基本要素

  1. Color - 鮮やかで階層的な色使い
  2. Shape - 大きな角丸とピル形状
  3. Size - 重要な要素を大きく表示
  4. Motion - スプリングベースの自然なアニメーション
  5. Containment - 関連コンテンツの論理的なグルーピング

技術スタック

  • Tailwind CSS v4 - ユーティリティクラス(@theme inlineでカスタムプロパティを定義)
  • shadcn/ui - コンポーネントの基盤(shadcn/tailwind.cssをインポート)
  • @base-ui/react - ヘッドレスUIプリミティブ(Button, Input, Separator等)
  • class-variance-authority (cva) - バリアント管理
  • oklch - カラースペース

Shape(角丸)

このプロジェクトでは以下のTailwind角丸クラスをM3 Expressiveのシェイプスケールにマッピングしている:

M3 Shape ScaleTailwindクラス用途
Full (pill)rounded-4xlButton, Badge, Input(インタラクティブ要素)
Extra Largerounded-3xlCard外側
Largerounded-2xlCard内側(画像、ヘッダー、フッター)
Mediumrounded-xlネストされたサブ要素(FieldLabel内のField等)
Smallrounded-lg小さなUI要素

重要: M3 Expressiveではインタラクティブ要素(ボタン、入力フィールド、バッジ)にFull(ピル)形状を使用する。これはフラットデザインからの脱却を意味する。

Color

カラーロール

oklchカラースペースを使用。プライマリのhueは270(パープル/インディゴ)。

ロールLightDark用途
primaryoklch(0.49 0.205 270)oklch(0.735 0.12 270)メインアクション、アクティブ状態
primary-foregroundoklch(0.98 0.005 270)oklch(0.2 0.04 270)primary上のテキスト
secondaryoklch(0.935 0.02 270)oklch(0.28 0.03 270)低強調コンポーネント
mutedoklch(0.95 0.01 270)oklch(0.235 0.02 270)背景、非アクティブ要素
destructiveoklch(0.58 0.24 25)oklch(0.7 0.19 22)エラー、削除アクション
backgroundoklch(0.985 0.004 270)oklch(0.155 0.02 270)ページ背景
cardoklch(0.995 0.002 270)oklch(0.2 0.025 270)カード背景
borderoklch(0.91 0.01 270)oklch(1 0 0 / 12%)ボーダー

透明度パターン

M3 Expressiveでは色の透明度を使って階層を表現する:

  • bg-primary/8 - ゴースト/アウトラインのホバー状態
  • bg-primary/12 - ダークモードでのゴーストホバー
  • bg-primary/85 - Filledボタンのホバー
  • bg-primary/5 - テーブル行のホバー
  • bg-destructive/10 - destructiveの背景(ライト)
  • bg-destructive/20 - destructiveの背景(ダーク)
  • border-border/40 - カードの薄いボーダー
  • bg-muted/50 - 入力フィールドの背景
  • bg-muted/60 - テーブルヘッダー

Typography

フォント: Noto Sans JP Variable@fontsource-variable/noto-sans-jp

用途クラス
カードタイトルtext-lg font-semibold tracking-tight
ラベル・フィールドタイトルtext-sm font-semibold
説明文text-muted-foreground text-sm
テーブルヘッダーtext-muted-foreground text-xs font-semibold
本文text-sm(デフォルト)

Motion

アクティブプレス

code
motion-safe:active:scale-[0.97]

ボタン等のインタラクティブ要素にスプリングベースの押下感を与える。motion-safe:プレフィックスでモーション低減設定を尊重する。

トランジション

要素クラス
ボタン・入力transition-all duration-200
テーブル行transition-colors duration-150

Elevation(影)

M3 Expressiveではフラットなデザインを基本とし、影は控えめに使用:

  • shadow-sm - カード、Filledボタン
  • hover:shadow-md - Filledボタンのホバー時

Focus・バリデーション

すべてのインタラクティブ要素に共通:

code
focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]
aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40
aria-invalid:border-destructive dark:aria-invalid:border-destructive/50

詳細ガイド