Skip to content

feat(table): [PF-3917] document tokens in all themes/modes#141

Merged
nicolethoen merged 1 commit into
patternfly:mainfrom
jschuler:all-tokens
May 5, 2026
Merged

feat(table): [PF-3917] document tokens in all themes/modes#141
nicolethoen merged 1 commit into
patternfly:mainfrom
jschuler:all-tokens

Conversation

@jschuler

@jschuler jschuler commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Design Tokens Table Enhancements

🎯 Key Features

Global Search & Navigation

  • Implemented cross-category token search with "Also found in" links
  • Added clickable navigation between token references across categories
  • Tokens in derivation chains and "Used by" column now link to their respective categories
  • Category prefixes (e.g., [Semantic], [Base]) on all token references for clarity

Theme Management

  • Shared theme state across all categories (except Palette which is always "All themes")
  • Value-based grouping when "All themes" selected - shows which themes share the same value
  • Displays dash (—) for tokens without values in selected theme
  • Shows grouped theme counts with tooltips listing all included themes

"Used by" Column

  • New column for Base and Palette tokens showing reverse references
  • Built reference map to track which tokens use each base/palette token
  • Shows up to 3 references inline, 4+ in a popover
  • All references are clickable for easy navigation

🎨 UI/UX Improvements

  • Always abbreviate theme labels in value cells to prevent horizontal scrolling
  • Added theme abbreviation legend for accessibility

📝 Files Changed

  • tokensTable.js - Core functionality and component updates
  • tokensTable.css - New styles for grouped themes, buttons, and layout
  • tokensToolbar.js - Pre-computed static values, theme selection logic

Preview
http://patternfly-tokens.surge.sh/foundations-and-styles/design-tokens/all-design-tokens


return (
<Tooltip content={fullLabel} position="top">
<span className="ws-theme-display-label ws-theme-abbr-trigger" tabIndex={0}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be wrapping a plain button or other interactive element for accessibility.

white-space: nowrap;
}

.ws-token-value-popover-trigger {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the popover triggers shouldn't need so much custom CSS for formatting if they are using plain Buttons

@thatblindgeye thatblindgeye left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Some thoughts:

  • Could we omit the theme info from the "Values" cell if "All themes" isn't selected? It would free up some space, and I'm not sure if we need to provide abbreviations if we're showing a token value for a single theme; the Select toggle should provide the context of the values shown in the table whenever "All themes" isn't selected
    • We could maybe make a dynamic Table caption whenever "all themes" isn't selected - e.g. "Semantic tokens for Default theme, light mode, and default contrast"
  • When "All themes" is selected and the table displays the various "X themes" text, I'm wondering if instead of a tooltip we could use a Popover, and within that render an unordered list of the themes. Something like this:
    A popover showing the number of themes a token is applied to
    • Using a popover, we'd want to use a button on the trigger like Nicole said, and should also apply aria-haspopup="dialog" to the button
    • Also, we'd want to update the popover when clicking the token value so that we use an unordered list for the themes listed there as well
  • Maybe could use some input from others regarding the verbiage, but what do we think about using "theme" for the default or unified, "mode" for the light or dark, and "contrast" for, well, the contrast? idk if we really ever landed on what verbiage to use and think we've kinda used "theme" a bit interchangeably
    • Related, what do others think about replacing the vertical pipes in "Theme | Mode | Contrast" with "Theme, Mode, and Contrast"?
  • May not necessarily need to be as part of this PR, but we need to update the derived token value element in the "Values" cell. Right now it's just a span that applies PF button classes; it needs to be an actual Button component with the aria-haspopup mentioned above. Also, we need to update the aria-label so that it begins with the actual displayed text, e.g. "#0066cc. Show how pf-t--global--icon--color--brand--default is derived" (though we should think about shortening this to be more concise, or maybe using a separate icon button to trigger the popover and the value is just plain text)

@kmcfaul
kmcfaul requested a review from edonehoo April 24, 2026 14:18
@jcmill

jcmill commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Observation here: Each <tr> is currently wrapped in a <tbody>. It's currently outside the scoped improvements (which is looking awesome btw). It looks like this was intended in the previous version as an expandable, so ignore if that's the eventual intent. If not, it might be worth moving the tbody outside the map so it wraps the entire collection of rows instead. I think its in the TokensTableBody .

@jschuler

Copy link
Copy Markdown
Contributor Author

@thatblindgeye

When "All themes" is selected and the table displays the various "X themes" text, I'm wondering if instead of a tooltip we could use a Popover, and within that render an unordered list of the themes.

I like the lighter weight tooltip, it is skipped when tab focusing anyhow and the applicable themes are repeated in the actual value popover

Maybe could use some input from others regarding the verbiage, but what do we think about using "theme" for the default or unified, "mode" for the light or dark, and "contrast" for, well, the contrast? idk if we really ever landed on what verbiage to use and think we've kinda used "theme" a bit interchangeably

Isn't that already the case? At least that's how I've built the Select

Commas vs pipes

I like the pipes because I add additional spacing to line up the theme | mode | contrast

@jschuler

Copy link
Copy Markdown
Contributor Author

@thatblindgeye thatblindgeye left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks like the abbreviation legend is still there when all themes are selected:

Isn't that already the case? At least that's how I've built the Select

Ah yeah I just meant like more explicitly in the rendered text, like "Default theme | Light mode | ...". Not a blocker, though.

position="bottom"
minWidth="400px"
>
<Button

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Also just need to add aria-haspopup="dialog" to this Button

const isDisabled = THEME_INVARIANT_CATEGORIES.has(selectedCategory);

const SelectToggle = (toggleRef) => (
<MenuToggle

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Assuming this is the toggle for filtering by "all" or a single theme, let's also add an aria-label to be similar to that Button I commented on.

Basically, have the aria-label be [selected value], Filter by theme, to mimic what a native Select would convey (the current value + the label)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now the toggle will read e.g. "Select theme, current: Default theme | Light | Default contrast" or "Select theme, current: All themes".

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

So for this, we should have the currently selected value be at the start of the aria-label to satisfy WCAG 2.5.3, which states "A best practice is to have the text of the label at the start of the name."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

okay thanks, updated

return (
<Select
aria-label="Select theme"
role="menu"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We shouldn't override the listbox role that Select uses here

Suggested change
role="menu"

Comment on lines +497 to +501
<div style={{ marginBlockStart: 'var(--pf-t--global--spacer--xs)' }}>
{themeNames.map((name) => (
<div key={name}>
<ThemeDisplayLabel themeName={name} />
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For this Popover can we use a PF plain unordered list? Should keep things visually the same but would make the list of applicable themes easier to parse for AT

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've decided to keep the current structure since using List and ListItem does add more spacing between the items which I'd have to override in CSS otherwise

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We can revisit this down the line so it's fine if we keep it as-is for now, but the main reason I'd strongly suggest we use a list here is because it's intended to come across as a list of the X themes.

@jschuler

Copy link
Copy Markdown
Contributor Author

Looks like the abbreviation legend is still there when all themes are selected:

> Isn't that already the case? At least that's how I've built the Select

Ah yeah I just meant like more explicitly in the rendered text, like "Default theme | Light mode | ...". Not a blocker, though.

Yes, there are some tokens that have a specific value for just a single theme combo. They do have the full text in the tooltip though, and the value popover does as well. So I'd be fine with removing the abbreviations box at the top

Screenshot 2026-04-29 at 9 00 19 AM

@jschuler

Copy link
Copy Markdown
Contributor Author

@thatblindgeye http://patternfly-tokens.surge.sh/foundations-and-styles/design-tokens/all-design-tokens/ should have latest updates to address your comments, thanks!

@thatblindgeye thatblindgeye left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@jschuler overall this is looking nice 😎 Had a couple responses to comments above, only 1 I'd say is something we should change now

@nicolethoen
nicolethoen requested a review from lboehling April 29, 2026 15:49
@andrew-ronaldson
andrew-ronaldson self-requested a review April 29, 2026 19:47

@andrew-ronaldson andrew-ronaldson left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we do a separate dropdown for Default and Project felt. I found the list hard to scan because of the repeated "Default theme" | "light..." | "...contrast".

Could the Name column include the double hyphen "--pf-t--global..." Good for copying the token names if you're in product. Maybe in a follow up we could add a copy clipboard button for easy access.

The links have "[Semantic] pf-t--global.." at the start. Small nit but could it be "Semantic: --pf-t--global" or "(Semantic) --pf-t--global..."

@jschuler

Copy link
Copy Markdown
Contributor Author

Could we do a separate dropdown for Default and Project felt. I found the list hard to scan because of the repeated "Default theme" | "light..." | "...contrast".

Could the Name column include the double hyphen "--pf-t--global..." Good for copying the token names if you're in product. Maybe in a follow up we could add a copy clipboard button for easy access.

The links have "[Semantic] pf-t--global.." at the start. Small nit but could it be "Semantic: --pf-t--global" or "(Semantic) --pf-t--global..."

Do you mean separate out Unified theme options? I am not clear how the interaction should be. How about a horizontal rule instead in the single select?

I like your other 2 suggestions can make the change

@andrew-ronaldson

andrew-ronaldson commented Apr 29, 2026

Copy link
Copy Markdown

Something like this. It is also using the mono font and could just be the rh default font

Screenshot 2026-04-29 at 5 25 17 PM

@jschuler

Copy link
Copy Markdown
Contributor Author

Something like this. It is also using the mono font and could just be the rh default font

Screenshot 2026-04-29 at 5 25 17 PM

What about the "All themes" concept that shows groupings in the value cells? Maybe as the first option in the theme selector, and then disable the mode-contrast selector?

mono font was used to line up the text with the | pipes

Comment on lines 270 to 271

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
aria-label="Search for a token"
placeholder="Search for a token"

a nitpick, but since you can filter and change the table - "all tokens" isn't technically accurate as a placeholder

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is, since I added a new feature that does a cross search ;)

Screenshot 2026-05-01 at 4 06 47 PM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

or maybe I misunderstood, I can take your wording though

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah okay ty! Yeah I meant more so because you can filter the table, so the "search for a token" phrase would just be more applicable across any filtered view. looks good 👍

@edonehoo

Copy link
Copy Markdown
Contributor

feel the same about Andrew's comment about the current menu. I find it a bit complicated, but I also know it's a complex table

Or (granted I'm not a designer) @andrew-ronaldson would it be bad to just have 3 menus? And then a "Clear filters" link that would bring back the "All tokens" view? Maybe is too busy or confusing--just musing

image

@jschuler

jschuler commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

@andrew-ronaldson @edonehoo this is probably a good followup item, wdyt? so we can move a little faster on this PR.

I did add some horizontal rules between the sections though which should help a little

Screenshot 2026-05-01 at 4 02 43 PM

@andrew-ronaldson
andrew-ronaldson self-requested a review May 4, 2026 20:11
@jschuler jschuler changed the title PF-3917 - Document tokens in all themes/modes feat(table): [PF-3917] document tokens in all themes/modes May 5, 2026
@nicolethoen
nicolethoen merged commit 75af153 into patternfly:main May 5, 2026
3 checks passed
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lboehling

Copy link
Copy Markdown

late to the game here, but we'll need to update "Unified Theme" in the dropdown to say "Project Felt"

@nicolethoen @jschuler @andrew-ronaldson should i open a followup?

@jschuler

jschuler commented May 7, 2026

Copy link
Copy Markdown
Contributor Author

@lboehling yes please. So the Select should have entries like Project Felt | Light | Default contrast ?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants