Skip to content

Commit cb2bc7a

Browse files
committed
chore: add styling guide
1 parent 8da375b commit cb2bc7a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

STYLING.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# CSS Styling Guide
2+
3+
This document outlines the details of the CSS styling for Spectrum Web Components.
4+
5+
## Component Styling
6+
7+
For each component in the project, there are upto 3 CSS files:
8+
9+
- `spectrum-[component-name].css` - This is the CSS file for the component that is generated by the last build from the Spectrum CSS project before the cutoff.
10+
- `[component-name]-overrides.css` - This is the CSS file for the component that contains the system overrides for the component. It was also generated by the last build from the Spectrum CSS project before the cutoff.
11+
- `[component-name].css` - This is the main CSS file which imports the `spectrum-[component-name].css` and `[component-name]-overrides.css` files and additionally contains the component's custom styles.
12+
13+
### How to update the component styling
14+
15+
We will try to keep the concerns separate for the component styling and so depending on the changes, we will need to update the component styling in the following ways:
16+
17+
- If it's a fix to the core visual structure or token usage, it belongs in `spectrum-[component-name].css`.
18+
- If it's system-specific, it goes to `[component-name]-overrides.css`.
19+
- If it's something unique to SWC or a workaround, then `[component-name].css` is acceptable — but should be reviewed for long-term cleanup.
20+
21+
## Global styling (WIP)
22+
23+
SWC project uses styles package to manage the global css variables and styles for all three themes. The styles package can be found in `tools/styles`.
24+
25+
Hopefully, we'd never need to edit the styles package directly as these files are build from the processing of tokens package in the spectrum-css project.

0 commit comments

Comments
 (0)