FIG-001 · MASTHEAD

Svelte Scoped Props — explicit scoped class props for Svelte components

Explicit scoped class props for Svelte. Write parent-owned CSS once, pass it through scoped:class or scoped:<prop>, and let the preprocessor add the parent scope hash for client and SSR output.

get started ↗ api reference npm package
FIG-001
SHEET 01 / 05
proof cases
6
literal · dynamic · alias · spread
directives
2
scoped:class · scoped:<prop>
runtime helpers
1
dynamic ClassValue support
tarball
11.7kB
packed (npm gz)
runtime deps
0
helper ships with package
licence
MIT
on GitHub
FIG-002 / SPREAD

scope before spread.

The parent opts in with scoped:class. The middle child only spreads props, and the third child still receives the parent-owned class.

file · spread-forwarding.svelte prop scoped:class value parent-owned tone-split raised path parent → middle → third ● FORWARDED
parent call site <MiddleSpreadCard scoped:class={classValue} />
ClassValue parent-owned tone-split raised
01 · native element Parent CSS owns this class. class="parent-owned tone-split raised"
scope hash is already prop data
02 · spread through middle
Middle child forwards props with spread
Third child receives class="parent-owned tone-split raised svelte-1uha8ag".
FIG-003 / CAPABILITIES

why scoped props.

Parent-scoped CSS can opt into component boundaries without becoming global.

№ 01 / 06

Explicit opt-in

Use scoped:class or scoped:<prop> at the call site to say the parent owns this class.

№ 02 / 06

Parent CSS stays scoped

Parent selectors keep their Svelte hash and still reach the component prop that opts in.

№ 03 / 06

ClassValue support

String literals, arrays, and object maps keep the same shape while the parent hash is appended.

№ 04 / 06

SSR paint coverage

Server-rendered children receive the same parent-scoped styling before hydration.

№ 05 / 06

Prop aliases

Forward scoped classes through internalClass, contentClass, or any other explicit class-like prop.

№ 06 / 06

No child type graph

The experiment avoids guessing child prop types by making scoped intent part of the parent syntax.

FIG-004 / AI-READY

built for ai-assisted code.

Point Cursor, Claude Code, or any LLM at the manifests below and they know the scoped prop syntax — literals, ClassValue expressions, prop aliases, and SSR behavior.

FIG-005 / EXAMPLES

explore interactive examples.

Literal classes, dynamic ClassValue objects, prop aliases, and SSR paint all have visible cases in the test surface.

view all examples →
SET / JETBRAINS MONO + INTER
HUMANSPEAK · 2026
MIT LICENCE
● 0.1.1
SHEET 05 / 05
END OF DOCUMENT
↩ TO TOP