Skip to content

refactor: split recipe variants with splitVariants and fold variant keys - #5230

Merged
traefiker merged 8 commits into
traefik:masterfrom
gndz07:refactor/split-variants
Nov 27, 2026
Merged

traefiker merged 8 commits into
traefik:masterfrom
gndz07:refactor/split-variants

Conversation

@gndz07

@gndz07 gndz07 commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Description

Related to https://github.com/traefik/hub-issues/issues/3497.

Vanilla components now separate variant props from DOM props with a new splitVariants(recipe, props) helper, instead of picking each variant out by hand.

  • splitVariants reads the variant names from the recipe with recipe.variants(). A variant added to a recipe later reaches the class without code changes and never ends up as a DOM attribute.
  • Fold withVariantKeys wrapper into `splitVariants.
  • Most vanilla components use it. Components whose variants are derived, defaulted or read from context (Select, Toast, SegmentedControl, Input, Textarea) still split them by hand.

⚠️ no-merge until #5226 merged, and then this PR will need to be adjusted.

@gndz07 gndz07 added bot/no-merge status/2-needs-review kind/task Task which contains the implementation to follow when the PR will be created labels Nov 26, 2026
@gndz07
gndz07 requested a review from mdeliatf November 26, 2026 15:50
@mdeliatf
mdeliatf force-pushed the refactor/split-variants branch from 67088a9 to c33d590 Compare November 27, 2026 14:04
@mdeliatf

Copy link
Copy Markdown
Contributor

Adjusted after the rebase on #5226:

  • Link, Navigation and NavigationMenu now use splitVariants, since withVariantKeys is gone.
  • Fixed the Storybook build on master: vite-plugin-dts from vite.config.ts ran inside Storybook and threw on the missing vanilla.d.ts. It's now removed in .storybook/main.ts.

@mdeliatf mdeliatf left a comment

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.

LGTM

@traefiker
traefiker merged commit aeac177 into traefik:master Nov 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/task Task which contains the implementation to follow when the PR will be created

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants