Skip to content

Shadow DOM

Scoped styles for one component.

Set shadow = true and the component renders into its own shadow root. styles apply inside it only, and page styles do not leak in.

In TypeScript, declare both as protected. styles also takes an array of strings or of CSSStyleSheet objects, and shadow takes options such as { mode: 'closed' }.