Skip to content

chore: Styling v2 for slider and progress bar - #5188

Open
pan-kot wants to merge 2 commits into
mainfrom
chore-style-api-slider-progress-bar
Open

pan-kot wants to merge 2 commits into
mainfrom
chore-style-api-slider-progress-bar

Conversation

@pan-kot

@pan-kot pan-kot commented Oct 26, 2026

Copy link
Copy Markdown
Member

Description

New APIs are reflected in the tracker: P3d34KdbCd6o.

How has this been tested?

Unit tests and test pages

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

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.73%. Comparing base (1f35242) to head (a190b79).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5188   +/-   ##
=======================================
  Coverage   97.73%   97.73%           
=======================================
  Files         996      998    +2     
  Lines       32222    32297   +75     
  Branches    11909    11945   +36     
=======================================
+ Hits        31493    31567   +74     
- Misses        723      724    +1     
  Partials        6        6           

☔ View full report in Codecov by Harness.
📢 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.

Copilot AI 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.

🟡 Changes recommended

Filled slider ticks use the track color in several states instead of matching the customized value range.

1 open issue
What changed in this PR

Adds Style API v2 support to Slider and ProgressBar, enabling slot-based customization while retaining legacy styling fallbacks.

Changes:

  • Adds styling tokens and class-name slots for both components.
  • Makes progress percentage text directly styleable.
  • Adds slot-wiring unit tests and styled demo pages.
File Description
src/​slider/​styles.scss Adds track, value, and handle styling integration.
src/​slider/​mixins.scss Adds handle fill, halo, and radius tokens.
src/​slider/​internal.tsx Applies root and handle slot classes.
src/​slider/​index.tsx Forwards implicit styling classes.
src/​slider/​__tests__/​style-api.test.tsx Tests slot classes and DOM prop filtering.
src/​progress-bar/​styles.scss Adds bar tokens and percentage typography styles.
src/​progress-bar/​internal.tsx Replaces percentage Box with a styleable element.
src/​progress-bar/​index.tsx Applies and forwards styling classes.
src/​progress-bar/​__tests__/​style-api.test.tsx Tests styling slots across variants.
pages/​slider/​style-api-v2.scss Demonstrates custom colors and handle states.
pages/​slider/​style-api-v2.page.tsx Adds interactive, disabled, and read-only examples.
pages/​progress-bar/​style-api-v2.scss Defines custom bar and percentage styles.
pages/​progress-bar/​style-api-v2.page.tsx Adds styled progress bar examples.

Review effort: Balanced

Comment thread src/slider/styles.scss Outdated
@pan-kot
pan-kot requested review from amanabiy and removed request for ywyyu17 October 28, 2026 07:18
@include progress-bar.root(
$track-color: palette.$subtle,
$value-color: palette.$accent,
$bar-border-radius: 2px,

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.

Can we prefix this with awsui- like $awsui-bar-border-radius, so it's clear it only accepts a single value? For example, 4px 8px wouldn't work here. According to the doc: UM9CHZ8CCdFl

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.

We will add this change to the component toolkit part that generates css vars, docs, and mixins: every token that we pass to the style-api.docs() util will be automatically prefixed with awsui-.

SPDX-License-Identifier: Apache-2.0
*/

/* stylelint-disable selector-combinator-disallowed-list */

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.

nit: why this was needed?

Comment thread src/slider/index.tsx
tickMarks={tickMarks}
hideFillLine={hideFillLine}
style={style}
styleClassNames={(props as { styleClassNames?: StyleClassNames }).styleClassNames}

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.

nit: why do we need this? {...props} on the next line already passes it to the component

This branch was successfully deployed

3 active deployments
dev-pages-react18 — a190b79e Deployed Oct 28, 2026 by pan-kot via deploy (React 18) / deploy #3022
dev-pages-react16 — a190b79e Deployed Oct 28, 2026 by pan-kot via deploy (React 16) / deploy #3022
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