---
title: class:
---
The `class:` directive is a convenient way to conditionally set classes on elements, as an alternative to using conditional expressions inside `class` attributes:
```svelte
...
...
```
As with other directives, we can use a shorthand when the name of the class coincides with the value:
```svelte
...
```
Multiple `class:` directives can be added to a single element:
```svelte
...
```