Skip to content

Conversation

@spburtsev
Copy link
Contributor

@spburtsev spburtsev commented Dec 5, 2025

Fixes #2411, supports #2105

Breaking changes:

  • labelText slot renamed to labelChildren to resolve Svelte 5 errors when passing snippets

In Svelte 5, having both a labelText prop and labelText slot causes the static analyzer to flag errors when using snippet syntax. Renaming the slot eliminates this error and creates a clearer distinction between text-only labels (prop) and rich content labels (slot/snippet).

@metonym metonym force-pushed the distinct-label-children branch from 800af90 to cc3c9ef Compare December 7, 2025 20:17
Copy link
Collaborator

@metonym metonym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Thanks for fixing this papercut. My thoughts:

  • Scope: This solves a TypeScript issue with using #snippet with Svelte 5. No runtime issues, and slot can still be used. It's acceptable to make a breaking change, since downstream impact is minimal (should be a one-line change).
  • Naming: I like the prefix<Children> pattern. children is now a reserved prop in Svelte 5, but I think the pattern is semantic. I'd also considered prefix<Slot>, but "slots" are already legacy.
  • Other shadowed prop names: There are other shadowed prop names; I've created these as sub-issues of #2105.

I added more test coverage for named slots in #2410.

I rebased on master and grouped related changes into their distinct commits.

@metonym metonym merged commit ed1336b into carbon-design-system:master Dec 7, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Svelte 5] Rename labelText slot to labelChildren

2 participants