Skip to content

Commit d4220ba

Browse files
committed
docs: migration css info refinement
1 parent 5c8eff6 commit d4220ba

5 files changed

Lines changed: 68 additions & 9 deletions

File tree

2nd-gen/packages/swc/components/badge/migration.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ Find and replace all instances of `sp-badge` with `swc-badge` in your templates
6969

7070
### CSS custom properties
7171

72-
All `--mod-badge-*` custom properties have been renamed to `--swc-badge-*`. Update any
73-
overrides in your stylesheets:
72+
All `--mod-badge-*` custom properties have been removed. Replace them with the
73+
`--swc-badge-*` equivalents in your stylesheets:
7474

7575
| Removed (1st-gen) | Replacement (2nd-gen) |
7676
| ------------------------------------------- | ------------------------------ |
@@ -99,6 +99,30 @@ swc-badge {
9999
}
100100
```
101101

102+
> **Note on per-variant color overrides:** Semantic variants (`neutral`, `informative`,
103+
> `positive`, `negative`, `notice`, `accent`) use attribute-based selectors internally,
104+
> so consumer per-variant overrides work as expected:
105+
>
106+
> ```css
107+
> swc-badge[variant='positive'] {
108+
> --swc-badge-background-color: darkgreen;
109+
> }
110+
> ```
111+
>
112+
> Non-semantic color variants (`gray`, `red`, `orange`, `yellow`, `chartreuse`, `celery`,
113+
> `green`, `seafoam`, `cyan`, `blue`, `indigo`, `purple`, `fuchsia`, `magenta`, `pink`,
114+
> `turquoise`, `brown`, `cinnamon`, `silver`) are applied via internal class selectors.
115+
> A consumer attribute selector targeting one of these variants will not reliably override
116+
> its color properties — use a global (unscoped) override instead, which will affect all
117+
> variants:
118+
>
119+
> ```css
120+
> /* Works — but applies to all badge instances */
121+
> swc-badge {
122+
> --swc-badge-background-color: rebeccapurple;
123+
> }
124+
> ```
125+
102126
---
103127
104128
## New in 2nd-gen

2nd-gen/packages/swc/components/divider/migration.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ Find and replace all instances of `sp-divider` with `swc-divider` in your templa
7171

7272
### CSS custom properties
7373

74-
All `--mod-divider-*` custom properties have been renamed to `--swc-divider-*`. Update
75-
any overrides in your stylesheets:
74+
All `--mod-divider-*` custom properties have been removed. Replace them with the
75+
`--swc-divider-*` equivalents in your stylesheets:
7676

7777
| Removed (1st-gen) | Replacement (2nd-gen) |
7878
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
@@ -94,6 +94,11 @@ swc-divider {
9494
}
9595
```
9696

97+
> **Note on `static-color` overrides:** When `static-color="white"` or
98+
> `static-color="black"` is set, the component applies color values via internal class
99+
> selectors to ensure correct contrast on static backgrounds. Consumer overrides of
100+
> `--swc-divider-background-color` will not take effect when `static-color` is in use.
101+
97102
---
98103

99104
### Shadow DOM structure

2nd-gen/packages/swc/components/icon/migration.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ to the nearest available size:
183183

184184
### CSS custom properties
185185

186-
All `--mod-icon-*` custom properties have been renamed to `--swc-icon-*`:
186+
All `--mod-icon-*` custom properties have been removed. Replace them with the
187+
`--swc-icon-*` equivalents:
187188

188189
| Removed (1st-gen) | Replacement (2nd-gen) |
189190
| ------------------------ | ---------------------------------------------------- |

2nd-gen/packages/swc/components/progress-circle/migration.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ your templates and HTML.
7272

7373
### CSS custom properties
7474

75-
All `--mod-progress-circle-*` custom properties have been renamed to
76-
`--swc-progress-circle-*`. Update any overrides in your stylesheets:
75+
All `--mod-progress-circle-*` custom properties have been removed. Replace them with the
76+
`--swc-progress-circle-*` equivalents in your stylesheets:
7777

7878
| Removed (1st-gen) | Replacement (2nd-gen) |
7979
| ------------------------------------------ | ------------------------------------------ |
@@ -135,6 +135,12 @@ The `static-color` attribute now accepts `"black"` in addition to `"white"`, mat
135135
the Spectrum 2 specification. Use `static-color="black"` when placing the component on
136136
a light static background that falls outside the normal theme.
137137

138+
> **Note:** When `static-color` is set, the component applies track and fill colors via
139+
> internal class selectors to ensure correct contrast. Consumer overrides of
140+
> `--swc-progress-circle-track-border-color` and
141+
> `--swc-progress-circle-fill-border-color` will not take effect when `static-color` is
142+
> in use.
143+
138144
```html
139145
<!-- 1st-gen: white only -->
140146
<sp-progress-circle

2nd-gen/packages/swc/components/status-light/migration.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ that best represents your use case:
112112

113113
### CSS custom properties
114114

115-
All `--mod-statuslight-*` custom properties have been renamed to `--swc-statuslight-*`.
116-
Update any overrides in your stylesheets:
115+
All `--mod-statuslight-*` custom properties have been removed. Replace them with the
116+
`--swc-statuslight-*` equivalents in your stylesheets:
117117

118118
| Removed (1st-gen) | Replacement (2nd-gen) |
119119
| ------------------------------------------- | ---------------------------------- |
@@ -144,6 +144,29 @@ swc-status-light {
144144
}
145145
```
146146

147+
> **Note on per-variant color overrides:** Semantic variants (`neutral`, `info`,
148+
> `positive`, `negative`, `notice`) use attribute-based selectors internally, so
149+
> consumer per-variant overrides work as expected:
150+
>
151+
> ```css
152+
> swc-status-light[variant='positive'] {
153+
> --swc-statuslight-dot-color: darkgreen;
154+
> }
155+
> ```
156+
>
157+
> Color variants (`yellow`, `chartreuse`, `celery`, `seafoam`, `cyan`, `indigo`,
158+
> `purple`, `fuchsia`, `magenta`, `pink`, `turquoise`, `brown`, `cinnamon`, `silver`)
159+
> are applied via internal class selectors. A consumer attribute selector targeting one
160+
> of these variants will not reliably override `--swc-statuslight-dot-color` — use a
161+
> global (unscoped) override instead:
162+
>
163+
> ```css
164+
> /* Works — but applies to all status-light instances */
165+
> swc-status-light {
166+
> --swc-statuslight-dot-color: rebeccapurple;
167+
> }
168+
> ```
169+
147170
---
148171
149172
## New in 2nd-gen

0 commit comments

Comments
 (0)