Skip to content

Link 2.0 update #2956

@twjeffery

Description

@twjeffery

Link Component Style & Token Update Spec

1. Props & Variants Overview

Prop / Variant New? Notes
size: "xs", "s", "m", "l" New size variants that encapsulate typography, icon size, gap spacing, and all visual proportions
color: "interactive" Existing interactive color maintained as default
color: "light" Existing variant maintained - useful for dark backgrounds
:visited pseudo-state New visited state with specific color styling (#3f48c0)
:hover state Existing hover state, color updated to #045092
leadingicon Existing functionality, icon sizing automatically determined by Link size
trailingicon Existing functionality, icon sizing automatically determined by Link size
action/actionArg/actionArgs Existing navigation functionality unchanged
Wrapper Pattern CONFIRMED: Link wraps <a> elements, but now with size-aware styling

2. Style + Token Comparison Table

Token / Raw Style CSS Property Variant / State Current Value New Value Status Notes
link-color-default color Default {color.interactive.default} (#0070c4) #006dcc Updated Refined blue color for wrapped anchor elements
link-color-hover color Hover {color.interactive.hover} (#004f84) #045092 Updated Refined hover color for wrapped anchor elements
link-color-visited color Visited (none) #3f48c0 New token New visited state color for wrapped anchor elements
link-gap gap Default (Medium) 8px 4px ({space.2xs}) Updated Gap between icons and wrapped content
link-gap-xs gap XSmall (none) 3px New token XSmall size variant gap
link-gap-s gap Small (none) 3px New token Small size variant gap
link-gap-l gap Large (none) 5px New token Large size variant gap
link-icon-size Icon size prop Default (Medium) No size specified size="m" (20px) Updated Icon size passed to goa-icon component
link-icon-size-xs Icon size prop XSmall (none) size="s" (16px) New token XSmall variant icon size
link-icon-size-s Icon size prop Small (none) size="2" (18px) New token Small variant icon size
link-icon-size-l Icon size prop Large (none) size="l" (24px) New token Large variant icon size
link-color-light color Light variant {color.text.light} {color.text.light} Unchanged Maintained for dark background usage
link-typography font Default (Medium) {typography.body.m} {typography.body.m} (18px/28px) Unchanged Applied to wrapped anchor elements
link-typography-xs font XSmall (none) {typography.body.xs} (14px/20px) New token XSmall variant typography for wrapped content
link-typography-s font Small (none) {typography.body.s} (16px/24px) New token Small variant typography for wrapped content
link-typography-l font Large (none) {typography.body.l} (24px/32px) New token Large variant typography for wrapped content

3. New Tokens to Add

Token Name Value Description
--goa-link-typography-xs {typography.body.xs} XSmall link typography (14px/20px) applied to wrapped content
--goa-link-typography-s {typography.body.s} Small link typography (16px/24px) applied to wrapped content
--goa-link-typography-l {typography.body.l} Large link typography (24px/32px) applied to wrapped content
--goa-link-gap-xs 3px Gap between icons and wrapped content for XSmall size
--goa-link-gap-s 3px Gap between icons and wrapped content for Small size
--goa-link-gap-l 5px Gap between icons and wrapped content for Large size
--goa-link-color-visited #3f48c0 Color for visited state of wrapped anchor elements
--goa-link-color-default #006dcc Updated default color for wrapped anchor elements
--goa-link-color-hover #045092 Updated hover color for wrapped anchor elements

4. Deprecated / No Longer Used Tokens

Token Name Last Used In Notes
--goa-link-color-light Light color variant Needs clarification - Not present in v2.0 Figma design
--goa-link-color-light-hover Light color variant hover Needs clarification - Not present in v2.0 Figma design

5. Complete Design Token Inventory

Token Name Current Value Used For State/Variant CSS Property Status
--goa-link-color-default #006dcc Text color Default color Updated
--goa-link-color-hover #045092 Text color Hover color Updated
--goa-link-color-visited #3f48c0 Text color Visited color New
--goa-link-color-light {color.text.light} Text color Light variant color Review needed
--goa-link-color-light-hover {color.text.light} Text color Light variant hover color Review needed
--goa-link-typography {typography.body.m} Text styling Medium (default) font Current
--goa-link-typography-xs {typography.body.xs} Text styling XSmall font New
--goa-link-typography-s {typography.body.s} Text styling Small font New
--goa-link-typography-l {typography.body.l} Text styling Large font New
--goa-link-gap {space.2xs} (4px) Icon spacing Medium (default) gap Updated
--goa-link-gap-xs 3px Icon spacing XSmall gap New
--goa-link-gap-s 3px Icon spacing Small gap New
--goa-link-gap-l 5px Icon spacing Large gap New
--goa-link-icon-size {iconSize.3} (20px) Icon dimensions Medium (default) width/height Updated
--goa-link-icon-size-xs {iconSize.1} (16px) Icon dimensions XSmall width/height New
--goa-link-icon-size-s {iconSize.2} (18px) Icon dimensions Small width/height New
--goa-link-icon-size-l {iconSize.4} (24px) Icon dimensions Large width/height New
--goa-link-text-decoration underline Text decoration All text-decoration Current
--goa-link-display inline-flex Layout All display Current
--goa-link-align-items center Alignment All align-items Current

6. Implementation Notes

  • Size Variants: New size prop with "xs", "s", "m" (default), "l" options affects typography, icon size, and gap spacing
  • Encapsulated Sizing: Link size automatically determines typography, icon size, and gap - developers set one size for everything
  • Wrapper Pattern: Component wraps <a> elements and applies complete styling including typography, icons, and spacing
  • Typography Control: Link size applies appropriate typography to wrapped anchor elements for perfect proportions
  • Icon Size Mapping:
    • xs → goa-icon size="s" (16px)
    • s → goa-icon size="2" (18px)
    • m → goa-icon size="m" (20px)
    • l → goa-icon size="l" (24px)
  • Visited State: Implement using CSS :visited pseudo-class on wrapped anchor elements with new color (#3f48c0)
  • Gap Scaling: Size variants use different gap values (3px, 3px, 4px, 5px) for proportional spacing
  • Color Updates: All interactive colors applied to wrapped anchor elements for better contrast and hierarchy
  • Backward Compatibility: Default Medium size maintains similar behavior to current implementation
  • Component Structure: Size prop is additive - existing usage without size continues to work
  • Action Functionality: Existing action/navigation features unchanged
  • Developer Experience: Single size prop controls all visual proportions - no need to match icon/gap sizes manually

7. Clarifications Needed

Topic Context Suggested Action
None at this time All design decisions have been clarified Resolved: All clarifications provided

✅ Resolved Clarifications:

  • Light color variant: Maintained for dark background usage
  • Default size behavior: Medium (m) confirmed as default when size prop not specified
  • Icon alignment: Will be addressed in design review after initial implementation
  • Leading icon support: Maintained with same gap and proportions as trailing icons for each size

8. Existing Tokens Requiring Fallbacks

Token Usage Current Code Needs Fallback Suggested Fallback
var(--goa-color-interactive-default) No fallback #0070c4
var(--goa-color-interactive-hover) No fallback #004f84
var(--goa-color-text-light) No fallback white
var(--goa-typography-body-m) No fallback 18px/1.56 acumin-pro-semi-condensed, helvetica-neue, arial, sans-serif

9. Cross-Component Impact Analysis

Shared Token Used By Components Impact Assessment
Global color tokens All interactive components Verify color updates align with Button, Input, and other components
Typography tokens All text-containing components No impact - Link uses component-specific tokens
Icon size tokens Icon, Button, Input Ensure icon sizing consistency across components
Space tokens All components using spacing Minimal impact - Link uses mostly component-specific gap values
Link-button component LinkButton.svelte Review for shared styling patterns and ensure consistency

10. Implementation Risks & Mitigation

Risk Impact Mitigation Strategy
Size prop conflicts with existing layouts Links may appear different sizes unexpectedly Default to Medium size for backward compatibility, provide migration guide
Light variant removal breaks existing usage Components using light links may lose styling Investigate usage patterns, potentially maintain as deprecated but functional
Icon sizing misalignment Icons may not align properly with text in different sizes Test with common icons, ensure vertical alignment with font metrics
Visited state conflicts with application routing SPA routing may not trigger :visited correctly Document expected behavior, provide guidance for SPA implementations
Gap spacing too tight on touch devices Small gaps may affect touch accessibility Test on mobile devices, consider minimum touch target guidelines
Color accessibility concerns New colors may not meet WCAG requirements Verify all color combinations meet WCAG 2.1 AA contrast ratios

Handoff Checklist for Implementation

Before proceeding to the component-style-update-process.md implementation phase, ensure:

  • Complete design token inventory generated
  • All tokens without fallbacks identified and documented
  • Breaking changes documented with clear migration paths
  • Edge cases and clarifications resolved with user (light variant, default size, icon alignment)
  • Cross-component impact assessed and documented
  • Implementation risks identified with mitigation strategies
  • Specification document complete and ready for AI implementation
  • User has reviewed and approved all proposed changes

Additional Context

Current Implementation Files Analyzed:

  • Global tokens: /design-tokens/data/goa-global-design-tokens.json
  • Component tokens: No existing link-design-tokens.json file found
  • Link component: /ui-components/libs/web-components/src/components/link/Link.svelte
  • Related: /ui-components/libs/web-components/src/components/link-button/LinkButton.svelte

Figma Designs Analyzed:

  • Link component: https://www.figma.com/design/Kkd4vrWhbQ9Oqv0WufXbXC/v2.0?node-id=21567-617048

Key Changes Summary:

  1. New Size Variants: xs, s, m (default), l - controls icon size and gap spacing proportions
  2. Refined Color Palette: Updated default (#006dcc), hover (#045092), and new visited (#3f48c0) colors
  3. Size-Specific Spacing: Custom gap spacing for each size variant (3px, 3px, 4px, 5px)
  4. Icon Size Coordination: Icons automatically scale with Link size (16px, 18px, 20px, 24px)
  5. Typography Control: Component applies typography sizing to wrapped anchor elements for perfect proportions
  6. Visited State Support: New pseudo-class styling for link history indication
  7. Backward Compatibility: Medium size serves as default, maintaining existing behavior
  8. Encapsulated Sizing: Single size prop controls all visual proportions automatically

Expected Usage Patterns:

// Small link - Link component controls ALL sizing automatically
<GoabLink size="s" trailingIcon="open">
  <a href="/page">Small link text</a>
</GoabLink>
// Results in: 16px text, 18px icon, 3px gap

// Medium link (default) - perfect proportions automatically
<GoabLink trailingIcon="open"> {/* size="m" is default */}
  <a href="/page">Medium link text</a>
</GoabLink>
// Results in: 18px text, 20px icon, 4px gap

// Large link - everything scales together
<GoabLink size="l" trailingIcon="open">
  <a href="/page">Large link text</a>
</GoabLink>
// Results in: 24px text, 24px icon, 5px gap

// Extra small for compact interfaces
<GoabLink size="xs" trailingIcon="open">
  <a href="/page">Extra small link</a>
</GoabLink>
// Results in: 14px text, 16px icon, 3px gap

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Testing/Review

Relationships

None yet

Development

No branches or pull requests

Issue actions