# Module 11: Conceptual Specifications ## Lesson 3: Element & State Specifications **Deep dive on Layers 4 & 5 — Complete implementation details** --- ## The Final Layers You've specified pages, sections, and widgets. Now you document the details that developers implement: - **Layer 4: Cards** — Content grouping patterns - **Layer 5: Elements** — Individual UI pieces with complete state coverage These are the most detailed specifications. Get them right, and developers build exactly what you envisioned. --- ## Card-Level Specifications (Layer 4) Cards group related content into repeatable patterns. ### What Cards Define ``` Widget-Level: "Task list widget displays user tasks" ↓ Card-Level: "Each task card shows title, assignee, due date, status, and action buttons" ``` Cards answer: - **What content pattern does this represent?** - **What data structure feeds it?** - **How many instances appear?** - **Is it interactive?** --- ## Card Specification Pattern ```markdown ## Card: [Card Name] **ID:** [Parent-ID]-[Card-ID] ### Purpose [What this card displays/represents] ### Data Structure [Schema or data shape that feeds this card] ### Instances [Single/Template/Fixed count] ### Interaction [Static/Clickable/Expandable/Draggable] ### States [If interactive, document states] ### Content Slots [What content areas exist] ### Layout [Visual arrangement of elements] ### Contains [List child elements] ``` --- ## Card Example: Task Card ```markdown ## Card: Task Card **ID:** W01-C01-task-card ### Purpose Display one task with key information and actions. Allow quick status updates and task access. ### Data Structure ```json { "id": "string (UUID)", "title": "string (max 100 chars)", "assignee": { "id": "string", "name": "string", "avatar": "string (URL)" }, "dueDate": "ISO 8601 date string", "status": "enum (pending|in_progress|completed)", "priority": "enum (low|medium|high)" } ``` ### Instances Template card, rendered once per task (dynamic count) ### Interaction - Clickable: Yes (entire card navigates to task detail) - Expandable: No - Draggable: Yes (for reordering in list) ### States - Default: White background, normal text - Hover: Light gray background (#F3F4F6) - Pressed: Slight scale down (0.98) - Dragging: Lifted appearance (shadow), slightly rotated - Overdue: Red accent border when past due date - Completed: Strikethrough title, muted colors ### Content Slots - Priority indicator (left edge, colored bar) - Title text - Assignee avatar + name - Due date - Status badge - Quick action menu (three dots, right edge) ### Layout ``` ┌────────────────────────────────────┐ │ ┃ [Title Text] [•••] │ │ ┃ │ │ ┃ [👤 Assignee] [📅 Date] [●] │ └────────────────────────────────────┘ ↑ ↑ Priority Status ``` ### Contains - E01: Priority Bar - E02: Task Title - E03: Assignee Avatar - E04: Assignee Name - E05: Due Date Label - E06: Status Badge - E07: Action Menu Button ``` --- ## Card Example: Feature Card ```markdown ## Card: Feature Card **ID:** P01-S04-C01-feature-card ### Purpose Highlight one product feature to build trust before signup. ### Data Structure ```json { "icon": "string (icon identifier)", "title": "string (max 50 chars)", "description": "string (max 120 chars)" } ``` ### Instances Template, rendered 3 times with fixed data ### Interaction Static (not clickable) ### States N/A (no interactive states) ### Content Slots - Icon (centered, 48x48px) - Title (centered, h3) - Description (centered, body text) ### Layout ``` ┌─────────────────┐ │ │ │ [Icon] │ │ │ │ Feature Title │ │ │ │ Description │ │ text goes │ │ here │ │ │ └─────────────────┘ ``` ### Contains - E01: Feature Icon - E02: Feature Title - E03: Feature Description ``` --- ## Element-Level Specifications (Layer 5) Elements are the atomic UI pieces: buttons, inputs, labels, icons. ### What Elements Define ``` Card-Level: "Task card contains title, assignee, status" ↓ Element-Level: "Status badge has 3 states: pending (gray), in_progress (blue), completed (green), with specific text and aria-label for each" ``` Elements answer: - **What are ALL possible states?** - **What is the EXACT content?** - **What ARIA attributes apply?** - **How does it behave on interaction?** - **What are the translations?** --- ## Element Specification Pattern ```markdown ## Element: [Element Name] **ID:** [Full-Hierarchy-ID] ### Type [Button/Input/Label/Icon/Link/Text/etc.] ### States [Every possible state with complete description] ### Content - Label: "[Exact text]" - Placeholder: "[Exact text if applicable]" - Translations: [All supported languages] ### ARIA [All ARIA attributes for each state] ### Behavior [What happens on interaction] ### Visual [Colors, sizes, spacing if critical to specification] ``` --- ## Element Example: Submit Button ```markdown ## Element: Submit Button **ID:** P01-S03-W01-E05-submit-button ### Type Button (primary action) ### States #### Default - Label: "Create Free Account" - Appearance: Blue background (#2563EB), white text - Cursor: Pointer - Enabled: Yes - aria-disabled: "false" #### Hover - Appearance: Darker blue (#1E40AF) - Transition: 150ms ease - Everything else: Same as default #### Active (pressed) - Appearance: Even darker blue (#1E3A8A) - Scale: 0.98 (slight press effect) #### Disabled - Label: "Create Free Account" - Appearance: Gray background (#D1D5DB), gray text (#6B7280) - Cursor: Not-allowed - Enabled: No - aria-disabled: "true" - Reason: Form validation incomplete #### Loading - Label: [Hidden, replaced by spinner] - Appearance: Blue background, spinner centered - Cursor: Wait - Enabled: No (can't click during submit) - aria-busy: "true" - aria-label: "Creating account, please wait" #### Success (brief) - Label: [Hidden, replaced by checkmark ✓] - Appearance: Green background (#10B981) - Duration: 1.5s visible, then redirect - aria-label: "Account created successfully" #### Error (server error) - Returns to Default state - Error message appears above form (not on button) ### Content **English:** - Label: "Create Free Account" - Loading: aria-label "Creating account, please wait" - Success: aria-label "Account created successfully" **Spanish:** - Label: "Crear Cuenta Gratuita" - Loading: aria-label "Creando cuenta, por favor espere" - Success: aria-label "Cuenta creada exitosamente" **German:** - Label: "Kostenloses Konto erstellen" - Loading: aria-label "Konto wird erstellt, bitte warten" - Success: aria-label "Konto erfolgreich erstellt" ### ARIA **Default/Hover/Active:** - role: "button" (implicit from ``` ### Dropdown Container (when open) ```html ``` ### Focus Management 1. When opened: Focus moves to first menu item 2. Arrow Down: Next menu item 3. Arrow Up: Previous menu item 4. Home: First menu item 5. End: Last menu item 6. Escape: Close menu, return focus to trigger 7. Tab: Close menu, move focus to next focusable element 8. Click outside: Close menu, focus stays where clicked ### Screen Reader Announcements - Button: "User menu, button, collapsed" - Opens: "User menu, menu, 4 items" - Each item: "Profile, menu item" / "Settings, menu item" / etc. - Closes: "User menu, button, collapsed" ``` --- ## Translation Planning Document content in all supported languages: ```markdown ## Task Status Badge Translations ### English - pending: "Pending" - in_progress: "In Progress" - completed: "Completed" - overdue: "Overdue" ### Spanish - pending: "Pendiente" - in_progress: "En Progreso" - completed: "Completado" - overdue: "Atrasado" ### German - pending: "Ausstehend" - in_progress: "In Bearbeitung" - completed: "Abgeschlossen" - overdue: "Überfällig" ### French - pending: "En attente" - in_progress: "En cours" - completed: "Terminé" - overdue: "En retard" ### Text Expansion Considerations - English "Pending" (7 chars) - German "Ausstehend" (10 chars) — 43% longer - Design must accommodate ±40% expansion - Badge width: Min 80px to handle longest translation ``` --- ## Completeness Checklist Use this to verify each element specification: ### For Every Element: **States:** - [ ] All possible states documented - [ ] State transitions specified - [ ] Default state clearly identified - [ ] Edge case states covered **Content:** - [ ] Real text (not lorem ipsum) - [ ] All labels written - [ ] All error messages written - [ ] All helper text written - [ ] Translations provided (all supported languages) **Accessibility:** - [ ] ARIA role specified (if not semantic HTML) - [ ] aria-label provided (where needed) - [ ] aria-required for required fields - [ ] aria-invalid for validation states - [ ] aria-describedby for error messages - [ ] Focus management specified - [ ] Keyboard interactions documented - [ ] Screen reader behavior described **Behavior:** - [ ] Click/tap behavior defined - [ ] Keyboard behavior defined - [ ] Validation timing specified - [ ] Animation timing specified (if applicable) - [ ] What triggers state changes **Visual (if critical):** - [ ] Colors specified (with hex codes) - [ ] Sizes specified (touch targets 44px+) - [ ] Spacing specified (if precise) - [ ] Responsive behavior noted --- ## The Test **Your element specification is complete when:** ✅ A developer can build it without asking questions ✅ A translator can extract all content ✅ A tester can verify every state ✅ An accessibility auditor can validate ARIA ✅ A designer can recreate it 6 months later **If any role needs to guess, the spec is incomplete.** --- ## What's Next In the tutorial, you'll practice writing complete specifications with Freya guiding you through each section. She'll ensure nothing is missed. --- **[Continue to Tutorial: Write Your Specifications →](tutorial-11.md)** --- [← Back to Lesson 2](lesson-02-section-widget-specifications.md) | [Back to Module Overview](module-11-conceptual-specifications-overview.md) *Part of Module 11: Conceptual Specifications*