Skip to content

Conversation

@at-susie
Copy link
Member

@at-susie at-susie commented Nov 28, 2025

Description

As part of the iconography extension project, this PR introduces themeable border tokens that define stroke widths for each icon size variant. These tokens provide the flexibility needed to customize icon styling.

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

codecov bot commented Nov 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.12%. Comparing base (c02fc0d) to head (a7d68ec).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4079   +/-   ##
=======================================
  Coverage   97.12%   97.12%           
=======================================
  Files         864      864           
  Lines       25325    25325           
  Branches     9137     9137           
=======================================
  Hits        24597    24597           
  Misses        722      722           
  Partials        6        6           

☔ 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 +30 to +34
const [strokeSmall, setStrokeSmall] = useState<string>('1');
const [strokeNormal, setStrokeNormal] = useState<string>('1');
const [strokeMedium, setStrokeMedium] = useState<string>('1');
const [strokeBig, setStrokeBig] = useState<string>('1.5');
const [strokeLarge, setStrokeLarge] = useState<string>('2');
Copy link
Member

Choose a reason for hiding this comment

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

Does values are not aligned with the default values like 2px, 3px and 4px. Is this on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call. I will refine the UIs overall in the example page

Copy link
Member

Choose a reason for hiding this comment

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

Just a general question here to the formula at the end. The stroke width is divided by scale factor, which contradicts the token definition, for example for big would the calc: 3px/ 2 = 1.5px but it is defined as 3px in tokens.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for asking. The Cloudscape icon component provides the size property ranging from small to large. The way of handling the different icon sizes is to scale up and down by changing the CSS size property. This allows us to manage only one single icon svg resource and use it for different sizes.

However, when we scale the icon up (for example, 2x for "big" size), the stroke width would also scale proportionally, making it too thick. To maintain consistent visual weight across all icon sizes, we need to compensate by dividing the stroke width by the scale factor to make it render with the expected visual stroke widths, for example "big" size:

  • The icon itself is scaled up by 2x (from 16px to 32px)
  • The token borderWidthIconBig is defined as 3px
  • In the CSS, we apply: stroke-width: calc(3px / 2) = 1.5px
  • When the browser renders the scaled-up icon (2x), the effective stroke width becomes: 1.5px × 2 = 3px

value={strokeSmall}
onChange={evt => {
const numValue = parseFloat(evt.detail.value);
if (!isNaN(numValue) && numValue >= 1) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe to much but we could add here min/max constraints

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.

2 participants