Skip to content
Component Anatomy
ok: build 09:27 UTC main · dd6f9f7
Menu / Web Component

Web Component

Two vanilla custom elements with open shadow roots. Their parts live inside the shadow tree, and they render after the page loaded — the anatomy finds them anyway.

Root root

The <demo-field> host element, in the page's light DOM.

Label label

Inside the shadow root. Tied to the input with for, both in the same shadow tree.

Control control

Inside the shadow root. The bordered box holding the icon slot and the input.

Icon icon

A slotted child: it lives in the light DOM, next to the host, and renders through <slot name="icon">.

Input input

Inside the shadow root. The native <input>.

Hint hint

Inside the shadow root. Supporting text under the control.

Notifications
Control control

The <button role="switch">, exposed as part="control".

Track track

Exposed as part="track" — what demo-switch::part(track) styles from outside.

Thumb thumb

Exposed as part="thumb". No data-part anywhere: shadowParts reads the native names.

Label label

Exposed as part="label", wrapping the default slot.