컴포넌트
components 블록은 이름 붙은 UI 컴포넌트를 design tokens 기반의 구체적인 스타일 속성에 매핑합니다.
컴포넌트 속성
DESIGN.md 명세에서 각 컴포넌트 항목은 다음 규범적 속성을 허용합니다.
| 속성 | 기대 값 |
|---|---|
backgroundColor | 색상 리터럴 또는 {colors.*} 참조 |
textColor | 색상 리터럴 또는 {colors.*} 참조 |
typography | 복합 {typography.*} 참조 |
rounded | 치수 리터럴 또는 {rounded.*} 참조 |
padding | 치수 리터럴 또는 {spacing.*} 참조 |
size | 치수 리터럴 또는 {spacing.*} 참조 |
height | 치수 리터럴 또는 {spacing.*} 참조 |
width | 치수 리터럴 또는 {spacing.*} 참조 |
components:
button-primary:
backgroundColor: "{colors.primary}"
textColor: "{colors.on-primary}"
typography: "{typography.label-md}"
rounded: "{rounded.md}"
padding: 12px전역 토큰 카테고리와 달리 components에서는 원시 {colors.*}, {rounded.*}, {spacing.*} 토큰과 함께 복합 {typography.*} 토큰 참조도 허용됩니다.
인터랙션 상태를 형제 항목으로 표현하기
hover, active, focus, disabled 상태는 컴포넌트 아래에 중첩 객체로 두지 않고 평면 형제 키로 표현합니다.
components:
button-primary:
backgroundColor: "{colors.primary}"
textColor: "{colors.on-primary}"
rounded: "{rounded.md}"
padding: 12px
button-primary-hover:
backgroundColor: "#3730a3"
textColor: "{colors.on-primary}"
rounded: "{rounded.md}"
padding: 12px
button-primary-disabled:
backgroundColor: "{colors.surface}"
textColor: "{colors.text-muted}"
rounded: "{rounded.md}"
padding: 12px상태를 평면 구조로 유지하면 모든 항목이 심볼 테이블(components.button-primary-hover.backgroundColor)에서 일관되게 해석되고 여러 도구로 깔끔하게 내보낼 수 있습니다.
대신 산문에 작성할 내용
테두리, 박스 섀도, 내부 flex/grid 간격, 아이콘 크기 규칙, 반응형 스태킹 등은 YAML components 스키마에 전용 속성이 없습니다. 이런 내용은 ## Components Markdown 섹션에 문서화해 YAML 스키마를 비대하게 만들지 않으면서도 에이전트에 구조적 지침을 제공하세요.
## Components
- **Primary button (`button-primary`):** Minimum width `96px`, `1px` transparent border to prevent layout shift when paired with outlined secondary buttons, and `8px` gap between icon and label.
- **Card surface (`card-surface`):** Use a `1px solid` `{colors.border}` hairline instead of drop shadows on desktop grids.외부 템플릿 참조
컴포넌트는 다음과 같은 인라인 코드 참조로 레퍼런스 HTML이나 컴포넌트 스니펫을 가리킬 수 있습니다.
@components/button.html@components/card.html#card-elevated
경로는 DESIGN.md가 위치한 디렉터리를 기준으로 해석됩니다.
자동 컴포넌트 대비 검사
DesignMD Pro 검증기에 DESIGN.md를 붙여 넣으면 린터가 모든 컴포넌트의 전경 속성(color, text, textColor, foreground)과 배경 속성(background, backgroundColor, bg, surface, fill)의 대비를 검사합니다.
- 대비율
< 3:1→ 오류 (low-contrast) - 대비율
3:1~4.49:1→ 경고 (low-contrast) - 대비율
>= 4.5:1→ 일반 텍스트 WCAG AA 통과
예를 들어 위 button-primary-disabled에서 {colors.text-muted}(#52525b)와 {colors.surface}(#f6f5f4)의 대비를 검증하면 비활성 라벨의 가독성을 지킬 수 있습니다.
다음 단계
- 산문 섹션 — 다른 순서 섹션과 함께
## Components서술 작성하기 - 전체 예제 — 여러 컴포넌트가 포함된 전체
DESIGN.md살펴보기 - 검증기 및 린트 규칙 — 모든 참조 및 대비 검사 규칙 확인하기