Complete the code to add the class 'active' only when the variable isActive is true.
<button class:[1]={isActive}>Click me</button>
class:.The syntax class:active={isActive} adds the 'active' class only when isActive is true.
Complete the code to add the class 'hidden' only when the variable isHidden is true.
<div class:[1]={isHidden}>Content</div>
Using class:hidden={isHidden} will add the 'hidden' class only when isHidden is true.
Fix the error in the code to correctly add the class 'error' when hasError is true.
<p class:[1]={hasError}>Warning message</p>
The class name after class: must be 'error' to match the intended CSS class.
Fill both blanks to add 'active' class when isActive is true and 'disabled' class when isDisabled is true.
<button class:[1]={isActive} class:[2]={isDisabled}>Submit</button>
Use class:active={isActive} and class:disabled={isDisabled} to toggle classes based on variables.
Fill all three blanks to add 'highlight' when isHighlighted is true, 'selected' when isSelected is true, and 'focus' when isFocused is true.
<div class:[1]={isHighlighted} class:[2]={isSelected} class:[3]={isFocused}>Item</div>
Each class name matches the variable controlling its presence: highlight, selected, and focus.