Skip to content

DOL Design System - Shadow & Style Layers

activeUpdated

Scope: Shadow tier mapping, variable/effect/paint style precedence + paint style inventory. For philosophy: see DIRECTION.md §3 Style layer precedence + §9 Shadow philosophy. For code (Tailwind classes): see ../ui-style-guide/CORE.md §7 Shadow & Depth.

Tài liệu này cung cấp technical reference cho:

  • Variable-first rule chi tiết (khi nào dùng variable, alias)
  • Effect style (shadow tiers, colored shadow, focus ring, legacy ban)
  • Paint style (inventory canonical, khi nào được dùng)
  • Prompting rule cho AI builders

Triết lý precedence (Variable > Effect > Paint) và shadow direction → DIRECTION.md.

  • text hierarchy
  • semantic surface/fill
  • border và divider
  • spacing, inset, page padding, section gap
  • control height
  • radius

Nếu tool không hiểu full token graph:

  • ưu tiên các alias --ds-* trong DOL_General_AI_Theme_Adapter.css
  • chỉ dùng các role generic như --background, --primary, --radius-* khi tool bắt buộc cần app-theme convention

Default shadow family cho UI thường là:

  • shadow-neutral/to-bot/1
  • shadow-neutral/to-bot/2
  • shadow-neutral/to-bot/3
  • shadow-neutral/to-bot/4
  • shadow-neutral/to-bot/5

Mapping thực dụng:

LevelStyle mặc địnhKhi dùng
1shadow-neutral/to-bot/1card rất nhẹ, input group, surface tách lớp nhẹ
2shadow-neutral/to-bot/2dropdown nhỏ, popover nhẹ, sticky element nhẹ
3shadow-neutral/to-bot/3raised card chuẩn, panel được nhấn
4shadow-neutral/to-bot/4modal/sheet nổi rõ hơn bình thường
5shadow-neutral/to-bot/5hero floating, coachmark, premium emphasis

Code-facing Tailwind mapping:

TailwindEffect style
shadow-sm / shadowshadow-neutral/to-bot/1
shadow-mdshadow-neutral/to-bot/2
shadow-lgshadow-neutral/to-bot/3
shadow-xlshadow-neutral/to-bot/4
shadow-2xlshadow-neutral/to-bot/5

Tailwind mapping dùng literal shadow values để giữ shadow-brand-600/10, shadow-info-600/10, v.v. hoạt động. Không map trực tiếp shadow-* qua var(--shadow-neutral-*) trong Tailwind config.

  • to-top, to-left, to-right chỉ dùng khi có lý do về hướng bề mặt hoặc animation.
  • Nếu không có lý do rõ, dùng to-bot.

Colored shadow families như:

  • shadow-brand
  • shadow-info
  • shadow-success
  • shadow-warning
  • shadow-danger
  • shadow-special
  • shadow-AI
  • shadow-paper

chỉ nên dùng khi:

  • cần accent có chủ đích theo brand/category
  • surface đó thật sự mang tính campaign, special state, hoặc themed section

Không dùng colored shadows làm default elevation cho layout bình thường.

  • Dùng Interactive/FocusRing cho treatment focus khi cần style đã canon.
  • Không thay focus ring bằng colored shadow level 3/4/5.
  • Không dùng Shadow black (old) cho thiết kế mới.
  • Chỉ giữ để backward compatibility hoặc đọc file cũ.
  • là decorative background đã canon hoá
  • là reusable media/image slot
  • là branded gradient có naming rõ
  • component spec hoặc screen spec gọi đúng style name

Các family hiện tại gồm:

  • Overlay
  • Img lib
  • ComponentBgColor
  • AI
  • Gradient Practice
  • Ranking
  • DOL PRO
  • Social
  • body text color
  • heading text color
  • semantic border
  • input/background cơ bản
  • state color cơ bản như success/warning/error/info
  • Nếu AI chỉ cần “background nhẹ”, “surface phụ”, “panel nhấn”, hãy dùng semantic variables chứ không chọn gradient.
  • Chỉ gọi paint style khi muốn đúng một branded treatment đã tồn tại, ví dụ DOL PRO/pro-gradient-linear-1 hoặc Ranking/Top 1.

Khi prompt AI builder:

  • mô tả semantic token trước: text, surface, border, radius, spacing
  • mô tả effect style sau nếu cần độ nổi
  • chỉ nhắc paint style nếu cần đúng branded/decorative treatment

Ví dụ tốt:

  • “Use text-color/neutral-primary, roomy spacing, shadow-neutral/to-bot/2, radius soft-large.”
  • “Use DOL PRO gradient treatment only for the premium hero card, keep the rest semantic-first.”

Ví dụ không tốt:

  • “Use any nice gradient for cards.”
  • “Use shadow to separate everything.”
  • UI này đã dùng semantic variable làm mặc định chưa?
  • Shadow đang là shadow-neutral hay đang lạm dụng colored shadow?
  • Paint style có phải là decorative asset thật sự cần thiết không?
  • Có đang dùng legacy Shadow black (old) không?
  • Nếu export sang AI builder, adapter có đủ alias cho phần core chưa?
  • Hub: README.md
  • Direction & philosophy: DIRECTION.md
  • Related topic files: color.md
  • Code reference: ../ui-style-guide/CORE.md §7 Shadow & Depth (Tailwind scale remapped to DOL neutral tone)