Skip to content

chore: Add themeable tokens for button#4395

Open
at-susie wants to merge 27 commits intomainfrom
feat/theme-button
Open

chore: Add themeable tokens for button#4395
at-susie wants to merge 27 commits intomainfrom
feat/theme-button

Conversation

@at-susie
Copy link
Copy Markdown
Member

Description

This PR adds independently themeable design tokens for the button component. Specifically it introduces dedicated color tokens for the link button variant to achieve parity with normal and primary variants, and adds a new spaceButtonVertical spacing token so button padding is themeable in both directions. No visual changes — all new tokens default to the previous values.

Related links, issue #, if available: n/a

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.45%. Comparing base (59a24c5) to head (446feff).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4395   +/-   ##
=======================================
  Coverage   97.45%   97.45%           
=======================================
  Files         909      909           
  Lines       26638    26638           
  Branches     9615     9616    +1     
=======================================
  Hits        25959    25959           
+ Misses        673      636   -37     
- Partials        6       43   +37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +568 to +582
colorTextButtonInlineIconDefault: {
description: 'The default color of inline button icons.',
themeable: true,
public: true,
},
colorTextButtonInlineIconDisabled: {
description: 'The color of inline button icons in disabled state.',
themeable: true,
public: true,
},
colorTextButtonInlineIconHover: {
description: 'The color of inline button icons in hover state.',
themeable: true,
public: true,
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These weren't explicitly mentioned in the PR description, so just making sure they are supposed to be here.

Copy link
Copy Markdown
Member Author

@at-susie at-susie Apr 8, 2026

Choose a reason for hiding this comment

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

These existing tokens currently defaults to colorTextLinkXxx, which are currently not themeable, but need to be individually themeable.

public: true,
themeable: false,
},
spaceFieldHorizontal: {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need a vertical one for this as well since buttons and fields should be the same height?

Copy link
Copy Markdown
Member Author

@at-susie at-susie Mar 31, 2026

Choose a reason for hiding this comment

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

Changing vertical padding doesn't change the height of inputs, since the height of inputs is specified using the token sizeVerticalInput, so we might need to make it themeable. I'll look into it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Update:

  1. I made the sizeVerticalInput token themeable
  2. I introduced spaceControlVertical token to be able to individually theme

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

With the switch from 'inline-sizetomin-inline-sizechange, is thesizeVerticalInput` token redundant?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The sizeVerticalInput is still needed as min-block-size. We can also change from sizeVerticalInput to something like sizeMinVerticalInput to be explicit. WDYT?

inset-block-start: 1px;
inset-block-start: -1px;
inset-inline-end: -1px;
outline: solid 2px awsui.$color-background-layout-panel-content;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

perhaps this deserves its own token for toolbar-background?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It can, but that feels a bit out of scope for this PR. Happy to revisit whenever needed.

spaceAlertVertical: '{spaceFlashbarVertical}',
spaceButtonFocusOutlineGutter: '4px',
spaceButtonHorizontal: '{spaceScaledL}',
spaceButtonVertical: '{spaceScaledXxs}',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should this default to spaceControlVertical? Like spaceButtonVertical: '{spaceControlVertical}' since they should be the same most of the time?

Copy link
Copy Markdown
Member Author

@at-susie at-susie Apr 9, 2026

Choose a reason for hiding this comment

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

I would rather keep it separated from spaceControlVertical as button can have different stroke-widths And depending on that they need to adjust vertical padding independently. So they are different.

Comment on lines 22 to 23
$control-padding-vertical: awsui.$space-control-vertical;
$control-padding-horizontal: awsui.$space-field-horizontal;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I know these are kinda inconsistent in general, but since the horizontal token uses "field" naming, should we keep it consistent? awsui.$space-field-vertical?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated to be space-field-vertical


@include styles.font-body-m;
block-size: awsui.$size-vertical-input;
min-block-size: awsui.$size-vertical-input;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doesn't this change make the field respect awsui.$space-control-vertical when themed? If so, do we need to expose both? I would also double check that this change doesn't have any adverse effects across browsers or on fields that have multiple lines of text (e.g. dropdowns with additional metadata). IIRC, this used to cause issues in Safari, but it could be fixed by now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If we keep the block-size, it will not respect the awsui.$space-control-vertical when themed. That's why we need to make it min-block-size. This way, the min-block-size works as a guardrail while the awsui.$space-control-vertical is themeable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But it makes sense to double-check different examples.

&-multiselect-wrapper {
position: relative;
block-size: awsui.$size-vertical-input;
min-block-size: awsui.$size-vertical-input;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same comment here about the cross-browser behavior and redundant tokens.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

As mentioned in the above reply, we would rather need to make it min-block-size

public: true,
themeable: false,
},
spaceFieldHorizontal: {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

With the switch from 'inline-sizetomin-inline-sizechange, is thesizeVerticalInput` token redundant?

@at-susie at-susie requested a review from jkuelz April 8, 2026 20:18
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.

4 participants