Skip to content

feat(progress-bar): add recipe and tokens#31087

Open
thetaPC wants to merge 20 commits intoionic-modularfrom
FW-6857
Open

feat(progress-bar): add recipe and tokens#31087
thetaPC wants to merge 20 commits intoionic-modularfrom
FW-6857

Conversation

@thetaPC
Copy link
Copy Markdown
Contributor

@thetaPC thetaPC commented Apr 17, 2026

Issue number: internal


What is the current behavior?

Component styles for ion-progress-bar are fragmented across multiple files (native and ionic). The md and ios themes rely on the native styles. Developers were restricted to those themes and how those themes structured the logic and styles.

What is the new behavior?

  • Unified Style Architecture: Combined theme-specific styling into a single progress-bar.scss file that consumes CSS variables, ensuring a single source of truth for component logic.
  • Element-First Token Structure: Refactored the IonProgressBar type and tokens to use an element-first hierarchy ({type}.{element}.{state}, e.g., determinate.progress.default.background). This provides predictability and consistency with the rest of the system.
  • Defined TypeScript Interface: Added progress-bar.interfaces.ts with reusable types for the recipe and config.
  • Defined Theme Defaults: Added per-theme token defaults in ios, md, and ionic theme files.
  • Shape Support: Introduced round and rectangular shape variants with per-theme defaults (round for ios and ionic, rectangular for md).
  • Solid State Styling: Introduced dedicated styles for when the progress bar is fully buffered (buffer = 1), including separate rules for the buffer bar and buffer circles.
  • Type-Scoped CSS: Split generic buffer bar styles into type-specific selectors (progress-bar-type-determinate / progress-bar-type-indeterminate) to prevent cross-type style bleed.
  • Updated CSS Variables: Replaced --background and --progress-background with a structured set of semantic variables (e.g., --ion-progress-bar-determinate-progress-default-background).
  • Updated Tests: Added shape snapshot tests.

Does this introduce a breaking change?

  • Yes
  • No

This PR introduces breaking changes to how IonProgressBar is styled.

Migration Path:

  1. Token Updates: Update any custom theme configurations to match the new nested structure.

  2. CSS Variable Replacements: --background and --progress-background have been removed. Use the new token structure instead:

    • --backgroundIonProgressBar.determinate.buffer.bar.default.background (or the indeterminate equivalent)
    • --progress-backgroundIonProgressBar.determinate.progress.default.background (or the indeterminate equivalent)

If per-component customization is needed, the CSS variables can be used directly (e.g., --ion-progress-bar-determinate-progress-default-background).

  1. Host class names: The type classes on the host element have been renamed to include the prop name:

    • .progress-bar-determinate.progress-bar-type-determinate
    • .progress-bar-indeterminate.progress-bar-type-indeterminate
  2. Theme classes: Remove any instances that target the theme classes: ion-progress-bar.md, ion-progress-bar.ios.

Other information

Previews:
Previews:

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment Apr 22, 2026 10:33pm

Request Review

@github-actions github-actions Bot added the package: core @ionic/core package label Apr 17, 2026
Comment thread core/src/utils/theme.ts
subtle?: boolean;
}

export function ionColor(name: string, variation: string, options: IonColorOptions = {}): string {
Copy link
Copy Markdown
Contributor Author

@thetaPC thetaPC Apr 20, 2026

Choose a reason for hiding this comment

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

This function is originally added through the badge PR but it's still in progress so I added it here to not be blocked.

@thetaPC thetaPC marked this pull request as ready for review April 20, 2026 22:21
@thetaPC thetaPC requested a review from a team as a code owner April 20, 2026 22:21
@thetaPC thetaPC requested a review from OS-jacobbell April 20, 2026 22:21
Copy link
Copy Markdown
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

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

Looking good! Just a couple things I noticed but I could be off base

},

IonProgressBar: {
height: 'var(--token-scale-100, var(--ion-scaling-100))',
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.

var(--token-scale-100, var(--ion-scaling-100)) wraps a --token-* variable I couldn't find defined anywhere in the repo. Same on lines 532 and 538 with --token-round-xs and --token-rectangular-xs. Is this intentional scaffolding for the ionic modular work? If not, the other component entries in this file (IonChip, IonSpinner, IonItemDivider) reference --ion-* directly, so maybe this should too? Not sure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, I meant to add a comment here.

You're right that --token-* variables don't exist in this repo. They're defined in the OS project. The intent was to make it easier for the components team to adopt the Ionic token file in the future by referencing --token-* first with --ion-* as a fallback. The components team can override values at the token level without having to make as many changes here. If we approve this change, I plan to go back to the others and add the --token-* variables through a different PR. I figured if it gets denied, then no need to do that extra work. 😅

);
}

:host(.progress-bar-solid) .buffer-circles {
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.

When progress-bar-solid is set, the render function applies ion-hide (display: none !important) to the parent .buffer-circles-container, so this .buffer-circles rule inside it can't paint. Is the plan to drop the ion-hide toggle later and let CSS handle the hide, or is this rule dead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch! 6a19f57

It sounds like we will keep ion-hide but just a different class name.

class={{ 'buffer-circles-container': true, 'ion-hide': finalBuffer === 1 }}
class={{
'buffer-circles-container': true,
'buffer-circles-container-hidden': finalBuffer === 1,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added this class now so it would be easier to replace when we remove ion-hide.

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

Labels

package: angular @ionic/angular package package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants