Computed Attributes


Computed Attributes are attributes that are evaluated at runtime. They are prefixed with a #.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div #class={true ? "foo" : "bar"}>
        Hello there!
    </div>
</body>
</html>

Like normal attributes, computed attributes can be accessed through interpolation in Components.