Skip to content

[docs] remove opinions about which class directive to use #15113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions documentation/docs/03-template-syntax/18-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Svelte also exposes the `ClassValue` type, which is the type of value that the `

## The `class:` directive

Prior to Svelte 5.16, the `class:` directive was the most convenient way to set classes on elements conditionally.
For simple cases, the `class:` directive offers a convenient way to set classes on elements conditionally.

```svelte
<!-- These are equivalent -->
Expand All @@ -98,5 +98,3 @@ As with other directives, we can use a shorthand when the name of the class coin
```svelte
<div class:cool class:lame={!cool}>...</div>
```

> [!NOTE] Unless you're using an older version of Svelte, consider avoiding `class:`, since the attribute is more powerful and composable.
Loading