Skip to content

[6.x] Button single variant#19306

Draft
brianjhanson wants to merge 9 commits into
6.xfrom
feature/button-single-variant
Draft

[6.x] Button single variant#19306
brianjhanson wants to merge 9 commits into
6.xfrom
feature/button-single-variant

Conversation

@brianjhanson

Copy link
Copy Markdown
Contributor

Previously buttons has two customization axis. You could specify either a variant (accent, neutral or danger) and an appearance (solid, outline, fill, plain) to determine what your button looked like.

After revisiting (and looking at plugin kit, I feel like that's a bit overkill. This flattens appearance and variant into a single variant property which can be one of: primary, danger, danger-plain, solid, fill, outline, dashed, plain, link or none.

CleanShot 2026-07-24 at 10 23 47@2x

danger-plain is the only one that bugs me a bit, but I think that wart is better than having the ability to create buttons that may only appear once in the UI.

This also refactors the appearance=inherit property on buttons that will allow a button to take on the color of its colorable parent. That behavior is now created by specifying a single inherit value on the button.

CleanShot 2026-07-24 at 10 26 09@2x

In this mode primary and danger buttons retain their normal fill, but other buttons will try to blend in.

brianjhanson and others added 7 commits July 23, 2026 13:46
Replace the two-axis (variant + appearance) button API with one `variant`
property: primary, danger, solid, fill (default), outline, dashed, plain,
link, none. `primary`/`danger` are the colored, stable variants; the rest use
the neutral palette.

Add a boolean `inherit` property (orthogonal to variant) so neutral variants
adopt the ambient colorable palette in a [data-color]/callout context, while
primary/danger keep their own colors.

Rewrites button.styles.ts around the single axis, and updates the stories and
docs (combined the variant/appearance stories, added an Inherit demo).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adapt the package to the collapsed button API:
- index.ts stops re-exporting the removed ButtonAppearance.
- variants.styles.ts swaps the [variant='default'] block for [variant='accent']
  and [variant='neutral'] (used by callout/indicator/action-item).
- The tokens "Button Matrix" story and FilterHud now use the single variant axis
  (e.g. ButtonVariant.Fill / ButtonVariant.Primary).

Note: the broader app consumer migration (variant/appearance usages across
resources/js) is still pending and tracked separately.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
constants/colors.ts and scripts/generate-colors.js each hard-coded the color
palette and semantic map, and had drifted (info: blue vs sky, warning: orange
vs yellow; accent: red vs blue).

Introduce constants/colors.data.ts as the single source of truth. colors.ts
builds its Color map + ColorValue/ColorKey from it; generate-colors.js loads
it via esbuild (it can't import TS directly). Regenerate colorable.css — the
token output is unchanged except accent is corrected from a stale red to blue.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@brianjhanson
brianjhanson requested a review from gcamacho079 July 24, 2026 15:26
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant