Skip to content

feat(chip): sync the md theme with Material Design 2 - #31779

Open
thetaPC wants to merge 18 commits into
ionic-modularfrom
chip-md-sync
Open

thetaPC wants to merge 18 commits into
ionic-modularfrom
chip-md-sync

Conversation

@thetaPC

@thetaPC thetaPC commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Issue number: internal


What is the current behavior?

The md chip has 8px corners and inherits its letter spacing and line height. It has 8px between an icon and the label, a 32% outline border, and lighter focus backgrounds than Material Design 2. A pressed chip darkens under the ripple. Its rem and em values are rounded to two decimals, so it renders slightly larger than on next (14.08px instead of 14px).

What is the new behavior?

The md chip matches Material Design 2 (Material Components Web 14 and the MD2 kit):

  • Pill shape by default (round). soft stays 8px
  • 0.0179em (0.25px) letter spacing. The large chip has a 20px line height. The small chip has 4px 8px padding and a 16px line height, which keep it at 24px, since MD2 has no small chip
  • 4px between a slotted icon and the label
  • Outline chips without a color have a 12% border
  • Focus backgrounds are 21% (solid) and 10% (outline). A pressed chip keeps its resting background, and the ripple shows the press
  • Disabled opacity is 0.38
  • Font, icon and avatar sizes are no longer rounded, so they match next
  • padding, letterSpacing and line.height move under each size (for example IonChip.size.large.padding). The ionic theme looks the same

Does this introduce a breaking change?

  • Yes
  • No

The md chip changes its shape, typography, icon spacing, outline border, focus and pressed backgrounds, and disabled opacity. The chip section of BREAKING.md lists each one with the global token and CSS variable that revert it.

Other information

How to test

Check Before After What to look for
Shape Before After Chips are pills instead of rounded rectangles. Tap one: the ripple plays over the resting background, which no longer darkens
Typography and icons Before After Labels are slightly wider apart, icons sit closer to the label, and small chips are narrower at the same height
Outline border Before After Outline chips without a color have a lighter border
Focus and disabled Before After Focused chips without a color are darker, outline ones too. Disabled chips are a touch fainter

@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Nov 19, 2026 10:04pm UTC

Request Review

@thetaPC
thetaPC added this pull request to stack #31781 November 18, 2026 23:43
@thetaPC
thetaPC marked this pull request as ready for review November 19, 2026 01:44
@thetaPC
thetaPC requested a review from a team as a code owner November 19, 2026 01:44

@ShaneK ShaneK left a comment

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.

Looks good to me! Just a couple of small things on the states.

state: {
disabled: {
opacity: '0.4',
opacity: '0.38',

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 don't think anything tests the new md focus and disabled values yet. The states test only runs ios and ionic-md, with a comment saying md doesn't differ from ios, which isn't true after this PR. The regenerated md screenshots are all resting chips, so if these went back to 0.16 and 0.4 CI would still pass.

Could you add 'md' to that test's configs and drop the comment? If you'd rather not add more screenshots, something like this works too. It passes on this branch and fails on ionic-modular:

/**
 * This behavior does not vary across directions.
 */
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
  test.describe(title('chip: md states'), () => {
    test('should use the MD2 focus backgrounds', async ({ page }) => {
      await page.setContent(
        `
          <ion-chip class="ion-focused" fill="solid">Solid</ion-chip>
          <ion-chip class="ion-focused" fill="outline">Outline</ion-chip>
        `,
        config
      );

      const chips = page.locator('ion-chip');

      await expect(chips.nth(0)).toHaveCSS('background-color', 'rgba(0, 0, 0, 0.21)');
      await expect(chips.nth(1)).toHaveCSS('background-color', 'rgba(0, 0, 0, 0.1)');
    });

    test('should use the MD2 disabled opacity', async ({ page }) => {
      await page.setContent(`<ion-chip disabled="true">Disabled</ion-chip>`, config);

      await expect(page.locator('ion-chip')).toHaveCSS('opacity', '0.38');
    });
  });
});

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.

basic/chip.e2e.ts has the same "md doesn't differ from ios" comment (line 60), so it might be worth updating that one too while you're in there.

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.

Added md to the states test and removed the comment in 0e17e58, so the md focus and disabled screenshots now cover these values. I went with screenshots over the toHaveCSS checks to match the rest of the spec.

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.

Updated in 0e17e58. The hue tests already screenshot the md outline and color chips, so the comment now points there instead of adding md to this test.


activated: {
background: rgba('var(--ion-text-color-rgb, 0, 0, 0)', 0.2),
background: rgba('var(--ion-text-color-rgb, 0, 0, 0)', 0.21),

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 activated backgrounds removed, pressing a chip while hovering it with a mouse drops it back to its resting background, since the .ion-activated rule comes after :hover and falls back to the default. A bold solid chip goes from 0.16 on hover to 0.12 while pressed (it was 0.20 before), and an outline chip goes from 0.04 to transparent. The ripple still shows, but the chip gets lighter as you click it.

Was that intended for mouse too? Setting the activated backgrounds to the hover values would fix it on desktop, but I think it'd also tint touch presses, so I'm not sure which way is better here.

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.

One more case: colored chips do the same. A bold solid chip with a color goes from 12% of its color on hover to 8% while pressed, and a bold outline one goes from 12% to transparent, since the semantic activated backgrounds are gone too.

One way to fix it without tinting touch presses: move the @media (any-hover: hover) hover blocks after the .ion-activated rules in chip.scss, so hover wins while the pointer is over the chip and pressing just adds the ripple. That matches MDC, which keeps the hover layer under the press ripple.

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.

Not intended on desktop. Fixed in 29e7fe5: a hovered chip that's pressed now keeps its hover background, so it shows the hover tint plus the ripple. Touch presses stay untinted, since the new rule only applies inside (any-hover: hover) while the chip is hovered. Themes that set an activated background, like ios, still use it.

I also added a test that covers every hue, fill and color.

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.

Fixed in 29e7fe5, colored chips included. I didn't move the hover blocks after the activated rules: ios keeps a pressed background that's darker than its hover one, and on desktop hover would hide it. Instead, an .ion-activated:hover rule inside (any-hover: hover) falls back from the activated background to the hover one. md keeps the hover layer under the ripple like MDC, and ios keeps its pressed value.

@brandyscarney brandyscarney left a comment

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.

Looks good! Requesting changes for three things: the md outline chips are 2px taller than MD2 (34px large, 26px small), a hovered chip gets lighter when pressed now that the activated backgrounds are gone, and BREAKING.md is missing the subtle outline border change and the activated values to revert to. The rest are smaller questions and nits.

},

line: {
height: `${20 / components.chip.font.size}`,

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 explicit 20px line height, the large outline chips end up 34px tall: 6 + 20 + 6 + 2px of border. You can see it in the regenerated chip-hue-*-md snapshots, where the outline rows are 34px and the solid rows are 32px. Small outline chips work out to 26px instead of 24px. MD2's outlined chip is 32dp including the stroke. Could the outline variants take the border width out of the vertical padding?

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.

Fixed in adfb6c9. Outline chips now take their border width out of the vertical padding, so md outline chips are 32px and 24px like the solid ones.

I first tried dropping the vertical padding the way MDC does, but wrapped and scaled chips then lost their padding in the large text tests. The fix lives in chip.scss, so it also brings the ios outline chips from 30px to 28px in the ios PR.


activated: {
background: rgba('var(--ion-text-color-rgb, 0, 0, 0)', 0.2),
background: rgba('var(--ion-text-color-rgb, 0, 0, 0)', 0.21),

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.

One more case: colored chips do the same. A bold solid chip with a color goes from 12% of its color on hover to 8% while pressed, and a bold outline one goes from 12% to transparent, since the semantic activated backgrounds are gone too.

One way to fix it without tinting touch presses: move the @media (any-hover: hover) hover blocks after the .ion-activated rules in chip.scss, so hover wins while the pointer is over the chip and pressing just adds the ripple. That matches MDC, which keeps the hover layer under the press ripple.

state: {
disabled: {
opacity: '0.4',
opacity: '0.38',

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.

basic/chip.e2e.ts has the same "md doesn't differ from ios" comment (line 60), so it might be worth updating that one too while you're in there.

Comment thread BREAKING.md Outdated
- In the `md` theme, the chip now has a letter spacing of `0.0179em` (`0.25px` at `14px`), and the `large` chip a line height of `20px`, instead of inherited, in accordance with the Material Design 2 guidelines. To revert to the previous appearance, set `IonChip.size.large.letterSpacing` and `IonChip.size.large.line.height` to `inherit` for global styles, or `--ion-chip-size-large-letter-spacing` and `--ion-chip-size-large-line-height` for component-specific styles.
- In the `md` theme, a slotted `ion-icon` now has `4px` of space between it and the label instead of `8px`, in accordance with the Material Design 2 guidelines. To revert to the previous appearance, set `IonChip.icon.leading.margin.end` and `IonChip.icon.trailing.margin.start` to `8px` for global styles, or `--ion-chip-icon-leading-margin-end` and `--ion-chip-icon-trailing-margin-start` for component-specific styles.
- In the `md` theme, the border of an outline chip without a `color` is now `12%` of the text color instead of `32%`, in accordance with the Material Design 2 guidelines. To revert to the previous appearance, set `IonChip.hue.bold.outline.default.border.color` to `rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.32)` for global styles, or `--ion-chip-hue-bold-outline-default-border-color` for component-specific styles.
- In the `md` theme, a focused chip without a `color` now has a background of `21%` of the text color instead of `16%`, or `10%` instead of `4%` with an outline fill. A pressed chip now keeps its resting background under the ripple instead of darkening. Both follow the Material Design 2 guidelines. To revert to the previous appearance, set `IonChip.hue.bold.solid.focus.background`, `IonChip.hue.bold.outline.focus.background` and the `activated.background` of each hue and fill for global styles, or the matching `--ion-chip-hue-*-focus-background` and `--ion-chip-hue-*-activated-background` variables for component-specific styles.

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.

Could this one list the values to revert to, like the other bullets do? The previous values were:

  • Focus: 16% (bold solid) and 4% (bold outline)
  • Activated: 20% (bold solid), 8% (bold outline), 14% (subtle solid) and 4% (subtle outline) of the text color
  • Activated with a color: 16% of the color (bold) and 80% of the subtle color (subtle)

It's also worth saying that colored chips stop darkening when pressed too.

Separately, the subtle outline border also changes from 16% to 12%, but the border bullet only mentions IonChip.hue.bold.outline.default.border.color. Could that bullet cover IonChip.hue.subtle.outline.default.border.color (0.16) as well?

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.

Listed the bold focus and activated values to revert to in 9512e85, and the pressed bullet now says colored chips stop darkening too.

I left out the subtle values, including the subtle outline border. The subtle hue is new in v10 and hasn't been released, so there's no previous appearance to revert to.

Comment thread BREAKING.md Outdated
- The `outline` property has been deprecated. To achieve an outlined chip, set the `fill` property to `"outline"`. The class `.chip-outline` has also been updated to `.chip-fill-outline` for clarity.
- Specific mode classes (e.g., `ion-chip.md`) are no longer supported. Style modifications based on the active theme must be implemented using theme tokens rather than direct class targeting.
- The `border-radius` of the `ios` and `md` chip now defaults to `10px` and `8px`, respectively, instead of `16px` in accordance with the iOS and Material Design 3 guidelines. To revert to the previous appearance, set the `shape` to `"round"`, or override the `IonChip.shape.round.border.radius` to specify a different value for global styles and `--ion-chip-shape-round-border-radius` for component-specific styles.
- The `border-radius` of the `ios` chip now defaults to `10px` instead of `16px` in accordance with the iOS guidelines. The `md` chip keeps its pill shape, in accordance with the Material Design 2 guidelines. To revert to the previous appearance, set the `shape` to `"round"`, or override the `IonChip.shape.round.border.radius` to specify a different value for global styles and `--ion-chip-shape-round-border-radius` for component-specific styles.

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: since md already defaults to round, the "To revert … set the shape to "round"" sentence only applies to ios now. Maybe scope it to ios?

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.

Done in 5fa7c28.

small: {
padding: {

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 start/end padding at 8px now, a slotted avatar (still -8px margin) sits right against the edge of the small chip, while the large one keeps a 4px inset. Intentional?

The 24px avatar with -4px top and bottom margins also fills the 24px chip edge to edge vertically.

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.

Not intended. Fixed in cf65a8a: the avatar margins now live under each size, and the small md chip uses -6px, so the avatar sits 2px from the edge, matching its vertical inset.

The avatar in a small chip is 24/14em of its 12px font, about 21px, so it doesn't fill the 24px chip edge to edge.

# Conflicts:
#	core/src/components/avatar/test/basic/avatar.e2e.ts-snapshots/avatar-chip-diff-md-ltr-Mobile-Firefox-linux.png
#	core/src/components/chip/test/a11y/chip.e2e.ts-snapshots/chip-large-contents-md-ltr-Mobile-Firefox-linux.png

This branch was successfully deployed

1 active deployment
Preview — 225401d1 Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants