Skip to content

Svelte 5: this type of directive is not valid on components #12229

Closed as not planned
@orefalo

Description

@orefalo

Describe the bug

The code below will bark on class: "this type of directive is not valid on components"

This is very frustrating. Not only does it fail to compile, but manually creating the class string won't be detected by Svelte, and the .rtl CSS class will be marked as unused.

<MyComponent
    class:rtl={isRTL}>
This will not work, class: can't be used on custom components
</MyComponent>
...
<style>
  .rtl {
    direction: rtl;
  }
</style>

Reproduction

REPL

Logs

No response

System Info

any browser

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions