Skip to content

Conversation

@odaneau-astro
Copy link
Contributor

@odaneau-astro odaneau-astro commented Oct 2, 2025

Semantic Tokens Design Plan

Goal

Establish a well-structured semantic tokens hierarchy that provides clear separation between primitive design tokens, system-level semantic tokens, and component-specific tokens. This will improve maintainability, consistency, and developer experience when working with the Airflow UI theme system.

Current State

The current theme structure mixes reference tokens and semantic tokens without a clear hierarchy. Component-specific tokens are scattered throughout the codebase, making it difficult to maintain consistency and update the design system.

Proposed Solution: 3-Layer Token Hierarchy

Layer 1: Reference Tokens

Definition: All available Chakra UI "primitive" tokens. These tokens make up all of the style options available in Chakra UI's design system. The tokens point to a static value.

Example: tokens.colors.blue.50 is defined as "oklch(0.97 0.014 254.604)"

Chakra UI Token Types:

Purpose: These are the foundational building blocks. They represent raw design values and should rarely be used directly in components.

Layer 2: System Tokens

Definition: Airflow UI-specific "global" semantic tokens. The tokens point to a reference token and provide semantic meaning.

Example: semanticTokens.colors.info.solid is defined as tokens.colors.blue.600

Current System Tokens:

  • brand.* - Brand colors (solid, fg, bg, muted, subtle, emphasized, contrast, focusRing)
  • warning.* - Warning/alert colors
  • danger.* - Danger/error colors
  • error.* - Error colors
  • info.* - Informational colors
  • active.* - Active state colors
  • Task state colors: none.*, scheduled.*, queued.*, running.*, success.*, restarting.*, failed.*, skipped.*, upstream_failed.*, up_for_retry.*, up_for_reschedule.*, deferred.*, removed.*
  • System tokens: sys.text.*, sys.background.*, sys.surface.*, sys.border.*, sys.interaction.*

Purpose: These tokens provide semantic meaning and can be used across multiple components. They abstract away the specific color values and allow for easy theme updates.

Layer 3: Component Tokens

Definition: Single-use component-specific tokens that don't fit into the system-level semantic tokens.

Purpose: These tokens are specific to individual components and should be used sparingly. They allow for component-specific customization while maintaining consistency with the overall design system.

Out of scope:

  1. Chakra UI's styles feature:
  1. Chakra UI's recipe feature for component variants.

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Oct 2, 2025
@odaneau-astro odaneau-astro force-pushed the centralized_tokens branch 4 times, most recently from cc4e1e1 to fb2f695 Compare October 3, 2025 10:29
@odaneau-astro odaneau-astro marked this pull request as ready for review October 22, 2025 20:18
Copy link
Contributor

@bbovenzi bbovenzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big fan of moving all our colors to semantic tokens.

I think a number of these colors are too specific like calendar.hour-label.color and test-connection.icon.connected and we should try reuse more values. If we have a one-off difference, we should see if we can adjust that HTML element to fit an existing pattern before creating a new color token

{isParsing ? (
<Center mt={2}>
<Spinner color="brand.solid" marginRight={2} size="sm" /> Parsing file...
<Spinner color="import-variables.spinner.color" marginRight={2} size="sm" /> Parsing file...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels oddly specific. I feel like brand.solid was perfectly fine as a semantic token?

failed: { value: "{colors.red.500}" },
running: { value: "{colors.cyan.500}" },
queued: { value: "{colors.yellow.500}" },
skipped: { value: "{colors.gray.400}" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think skipped is supposed to be pink, no?

@odaneau-astro
Copy link
Contributor Author

odaneau-astro commented Oct 29, 2025

I agree, I'll do a second pass to regroup tokens, especially for reusable ones like Spinners, Boxes, Task States, etc.

@bbovenzi
Copy link
Contributor

Some merge conflicts

@pierrejeambrun
Copy link
Member

Gently pinging to know where we are on this one, should we convert it to draft in the meantime?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants