Agent SkillsIgniteUI/igniteui-webcomponents › update-component-styles

update-component-styles

GitHub

指导如何遵循 SCSS 到 Lit CSS 工作流更新组件样式,支持主题系统。适用于修改布局、颜色或适配不同主题(如 Indigo dark)等场景。

.github/skills/update-component-styles/SKILL.md IgniteUI/igniteui-webcomponents

Trigger Scenarios

更新组件边框圆角 添加按钮悬停样式 修复特定主题的芯片颜色

Install

npx skills add IgniteUI/igniteui-webcomponents --skill update-component-styles -g -y
More Options

Non-standard path

npx skills add https://github.com/IgniteUI/igniteui-webcomponents/tree/master/.github/skills/update-component-styles -g -y

Use without installing

npx skills use IgniteUI/igniteui-webcomponents@update-component-styles

指定 Agent (Claude Code)

npx skills add IgniteUI/igniteui-webcomponents --skill update-component-styles -a claude-code -g -y

安装 repo 全部 skill

npx skills add IgniteUI/igniteui-webcomponents --all -g -y

预览 repo 内 skill

npx skills add IgniteUI/igniteui-webcomponents --list

SKILL.md

Frontmatter
{
    "name": "update-component-styles",
    "description": "Update component styling following the SCSS to Lit CSS workflow with proper theme support"
}

Update Component Styles

Updates component styles through the project's SCSS → Lit CSS workflow and the igniteui-theming schema system.

When to Use

  • "Update the badge component border radius"
  • "Add hover styles to the button component"
  • "Fix the chip colors in the Indigo dark theme"

Related Skills

How the styles are organized

themes/
├── [component].base.scss       # Structure and layout, theme-agnostic
├── shared/
│   ├── [component].common.scss # Cross-theme styling; reads the CSS variables
│   └── [component].{bootstrap,material,fluent,indigo}.scss
├── light/
│   ├── _themes.scss            # digest-schema() of the light schemas
│   ├── [component].shared.scss # Full variable set from $base
│   └── [component].{bootstrap,material,fluent,indigo}.scss  # diff($base, $theme)
├── dark/
│   ├── _themes.scss            # digest-schema() of the dark schemas
│   └── [component].{bootstrap,material,fluent,indigo}.scss  # diff(light.$base, $theme)
└── themes.ts                   # Aggregates everything into the `all` export

Where a change belongs:

Change File
Layout, sizing, structure [component].base.scss
Styling driven by theme variables shared/[component].common.scss
One theme differs structurally shared/[component].[theme].scss
A color/elevation value for one theme light/ or dark/[component].[theme].scss
A new variable for every theme light/[component].shared.scss

Steps

1. Edit the SCSS

SCSS resolves against the src and node_modules load paths, so global helpers use package-style specifiers. Indentation is 4 spaces.

// ✅ DO
@use 'styles/utilities' as *;

// ❌ DON'T
@use '../../../styles/utilities' as *;

Theme values come from the digested schemas and are read with var-get():

// shared/[component].common.scss
@use 'styles/utilities' as *;
@use '../light/themes' as *;

$theme: $material;

:host {
    --component-size: var(--ig-size, #{var-get($theme, 'default-size')});
}

[part~='base'] {
    background: var-get($theme, 'background');
    color: var-get($theme, 'text-color');
    box-shadow: var-get($theme, 'elevation');
}

Per-theme overrides only emit the difference against the light base:

// dark/[component].bootstrap.scss
@use 'styles/utilities' as *;
@use 'themes' as *;
@use '../light/themes' as light;

$theme: $bootstrap;

:host {
    @include css-vars-from-theme(diff(light.$base, $theme));
}

Rules:

  • Never hardcode colors or sizes. Use var-get(), color(), contrast-color(), sizable() and the --ig-size scale.
  • Match parts with [part~='name'], not [part='name']partMap produces a space-separated list and an exact-match selector silently stops applying.
  • Keep selector specificity low so consumers can override through parts and custom properties.
  • A value that consumers should be able to set belongs in a documented CSS custom property; purely internal ones are prefixed with --_.

2. Add a new schema value (if needed)

var-get($theme, 'foo') only resolves for keys present in the igniteui-theming schema. If the value doesn't exist yet, either add it upstream in igniteui-theming or declare a local CSS variable in shared/[component].common.scss.

3. Expose and document new parts or custom properties

/**
 * @csspart base - The main container
 * @csspart content - The content wrapper
 * @cssproperty --component-padding - The internal padding
 */
protected override render() {
  return html`
    <div part=${partMap({ base: true, filled: this._hasValue })}>
      <span part="content"><slot></slot></span>
    </div>
  `;
}

Descriptions ship verbatim into the public API docs — no igc- tag names in the prose. After editing them, regenerate:

npm run cem && npm run build:meta

4. Transpile

npm run build:styles

[!IMPORTANT] This generates a .css.ts next to each .scss (imported as .css.js). The generated files are gitignored — never edit or commit them. Only files matching *.{base,common,shared,material,bootstrap,indigo,fluent}.scss under src/components/** are compiled; a differently named partial is skipped without a warning, so prefix helpers with _ and @use them.

npm run storybook and npm run test:watch run the style watcher for you.

5. Verify

npm run lint:styles  # stylelint
npm run storybook    # visual check

Check every theme in both light and dark mode, and confirm the parts and custom properties are still styleable from outside the component.

Validation Checklist

  • Only .scss files edited — no .css.ts changes staged
  • Load-path specifiers used (@use 'styles/utilities' as *)
  • Values read through var-get() / theming functions, nothing hardcoded
  • Part selectors use [part~='…']
  • Dark themes emit only the diff() against the light base
  • New parts and custom properties documented with @csspart / @cssproperty
  • npm run build:styles run, npm run lint:styles clean
  • All four themes checked in light and dark mode
  • CHANGELOG updated if the change is user-visible

Common Pitfalls

Symptom Cause / Fix
Style changes don't show up npm run build:styles not run, or the filename misses the build glob
Changes vanish on the next build A .css.ts file was edited directly — edit the .scss
Style applies in one theme only Put in a theme file instead of shared/[component].common.scss
A part selector stopped matching [part='base'] against a multi-name partMap — use [part~='base']
var-get() emits nothing The key is missing from the schema
Dark theme looks like light Missing diff(light.$base, $theme) or a missing themes.ts entry
Consumers can't override a style Selector specificity too high, or the element isn't exposed as a part

Reference Examples

  • src/components/badge/themes/ — compact, complete scaffold of the pattern above
  • src/components/input/themes/ — multiple parts, notched material layout, state selectors

Version History

  • 7.2.4 Current 2026-08-20 11:42

Same Skill Collection

.github/skills/add-component-property/SKILL.md
.github/skills/create-new-component/SKILL.md
.github/skills/review-component-pr/SKILL.md
skills/igniteui-wc-choose-components/SKILL.md
skills/igniteui-wc-customize-component-theme/SKILL.md
skills/igniteui-wc-integrate-with-framework/SKILL.md
skills/igniteui-wc-migrate-grid-lite-to-premium/SKILL.md
skills/igniteui-wc-optimize-bundle-size/SKILL.md
skills/igniteui-wc-generate-from-image-design/SKILL.md

Metadata

Files
0
Version
7.2.4
Hash
226a1100
Indexed
2026-08-20 11:42

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-24 18:52
浙ICP备14020137号-1 $방문자$