ui5/webcomponents/styling

Claude Code and agent skill by ui5/webcomponents

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

How to customize and style UI5 Web Components. Covers CSS shadow parts, CSS custom states, CSS variables, and tag-level styling. Use when the user asks about changing component appearance, colors, spacing, theming, or overriding styles.

Install

npx vskill@latest install ui5/webcomponents/styling

SKILL.md

The same SKILL.md was published earlier as ui5/webcomponents/styling.

Styling UI5 Web Components

UI5 Web Components use Shadow DOM for encapsulation. Styles are isolated — external CSS won't leak in, but customization requires specific techniques. There are five approaches, ordered from most recommended to least.

1. Styles on Tag Level

Some components (Title, Label, Tag, Button, Input, and others) are designed so that styles set directly on the custom element take effect.

css
ui5-input {
width: 150px;
color: yellow;
background: purple;
}

This works for simpler components. For complex components with deep DOM structures, tag-level styling has no effect on internal elements.

Best practice: Always use tag-level styling for sizing properties (margin, padding, width, height) to avoid design inconsistencies.

2. CSS Shadow Parts

For complex components, specific internal elements are exposed as CSS shadow parts.

css
ui5-card-header::part(status) {
color: red;
}

Important: Available shadow parts are listed in each component's API reference under the "Overview" section. Only documented parts are stable — do not rely on undocumented internal structure.

3. CSS Custom States

Components can expose custom states via the CSS custom state pseudo-class, allowing you to style based on internal component conditions.

css
ui5-toolbar-item:state(overflowed) {
flex-direction: column;
}

Important: Available custom states are listed in each component's API reference under the "Overview" section.

4. Overriding CSS Variables

UI5 Web Components use SAP CSS variables (--sap*) for theming. You can override these on a per-component or per-scope basis.

css
ui5-button {
--sapButton_TextColor: purple;
}

All global SAP CSS variables are defined in @sap-theming/theming-base-content. Overriding them changes the appearance of any component that uses them.

Best practice: For broad theme changes, prefer using the UI Theme Designer to ensure consistency. Use direct CSS variable overrides only for targeted, scoped customizations.

5. Custom CSS via addCustomCSS (Last Resort)

If none of the above work, custom CSS can be injected directly into a component's shadow DOM using the addCustomCSS API. It targets internal DOM structure that may change between versions. Only use it when CSS variables, tag-level styles, and shadow parts cannot achieve the desired result.

Before writing custom CSS:

  1. Find the component's template and existing styles in node_modules
  2. Optionally, inspect the component's shadow DOM in DevTools to understand the internal structure
  3. Target the minimal set of selectors needed

Custom CSS must be registered before any instances of the component are created:

javascript
import { addCustomCSS } from "@ui5/webcomponents-base/dist/Theming.js";
addCustomCSS("ui5-select", `
.ui5-select-root {
background-color: red;
}
`);

The first argument is the component's tag name, the second is a CSS string that gets injected into every instance's shadow DOM.

What NOT to Do

  • Don't pierce shadow DOM with deprecated >>> or /deep/ selectors — they don't work.
  • Don't rely on internal DOM structure — it can change between versions. Only use documented shadow parts.
  • Don't use `!important` on SAP variables — scope your overrides instead.
  • Don't override raw colors when a SAP CSS variable exists — use the variable to maintain theme consistency.

Quick Decision Guide

GoalTechnique
Change width, margin, paddingTag-level styles
Restyle a specific internal element::part(name)
Style based on component state:state(name)
Change colors/fonts globallyOverride --sap* CSS variables
Full theme customizationUI Theme Designer
Override internal shadow DOM stylesaddCustomCSS (last resort)

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1,794
Repository forks
293
7-day trend score
37

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 17 Mar 2026, 8 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ui5/webcomponents/styling/badge)](https://verified-skill.com/skills/ui5/webcomponents/styling)

Something wrong with this skill or its page? Tell us.