[CLOV-1341][BpkChip]Theming support to BpkChip#4272
Conversation
There was a problem hiding this comment.
Pull request overview
Adds broader theming support for BpkChip by switching more chip styles to CSS-variable-backed mixins, exposing new theme attribute groupings for consumers, and providing a Storybook example demonstrating overrides.
Changes:
- Updated chip SCSS mixin to make border-radius, colors, and borders themeable via CSS variable fallbacks.
- Expanded
bpk-component-chiptheme attribute exports (while preserving the original default export for backward compatibility) and added tests. - Added a new Storybook “Themed” example demonstrating chip theme overrides via
BpkThemeProvider.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
packages/bpk-mixins/_chips.scss |
Applies bpk-themeable-property/CSS var fallbacks across chip variants and introduces a helper for themeable borders. |
packages/bpk-component-chip/src/themeAttributes.ts |
Keeps the legacy default export intact and adds new grouped theme attribute exports. |
packages/bpk-component-chip/src/themeAttributes-test.ts |
Verifies backward compatibility and coverage for newly exported theme attribute groups. |
packages/bpk-component-chip/index.ts |
Re-exports new theme attribute groupings from the package entry point. |
examples/bpk-component-chip/stories.tsx |
Adds a new “Themed” story entry. |
examples/bpk-component-chip/examples.tsx |
Implements the new ThemedExample using BpkThemeProvider. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Visit https://backpack.github.io/storybook-prs/4272 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4272 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4272 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4272 to see this build running in a browser. |
Gert-Jan Vercauteren (gert-janvercauteren)
left a comment
There was a problem hiding this comment.
LGTM
| </BpkText> | ||
| <BpkThemeProvider | ||
| theme={{ | ||
| chipBorderRadius: '1rem', |
There was a problem hiding this comment.
can we use borderRadiusLg for chipBorderRadius
packages/bpk-mixins/_chips.scss
Outdated
| @include utils.bpk-themeable-property( | ||
| border-radius, | ||
| --bpk-chip-border-radius, | ||
| tokens.$bpk-border-radius-xs * 2 |
There was a problem hiding this comment.
it can use $bpk-border-radius-sm instead
|
Visit https://backpack.github.io/storybook-prs/4272 to see this build running in a browser. |
Summary
Adds full theming support to
BpkChipvia CSS custom properties, enabling consumers to override colours, borders, and border-radius throughBpkThemeProvider.What changed
packages/bpk-mixins/_chips.scssbpk-themeable-propertycalls across all three chip variants (default,on-dark,on-image) — covering background, text, hover, active, and selected states.bpk-chip-themeable-borderhelper mixin to work around the limitation thatbpk-border-sm(which usesbox-shadowshorthand) cannot accept a CSS variable directly. The two-line fallback pattern (box-shadowwith literal fallback +box-shadowwithvar()) is applied instead.border-radiusthemeable via--bpk-chip-border-radius.packages/bpk-component-chip/src/themeAttributes.tschipBorderRadiusThemeAttributes—['chipBorderRadius']chipDefaultThemeAttributes— 10 attributes covering all default variant stateschipOnDarkThemeAttributes— 9 attributes covering all on-dark variant stateschipOnImageThemeAttributes— 8 attributes covering all on-image variant statespackages/bpk-component-chip/index.tspackages/bpk-component-chip/src/themeAttributes-test.tsexamples/bpk-component-chip/examples.tsxThemedExampleStorybook story demonstrating a custom theme override usingBpkThemeProviderwithchipDefaultBorderColor,chipDefaultSelectedBackgroundColor,chipBorderRadius, and related attributes.Non-breaking
themeAttributesexport is preserved as-is.Remember to include the following changes:
[Clover-123][BpkButton] Updating the colourREADME.md(If you have created a new component)README.md