-
Notifications
You must be signed in to change notification settings - Fork 0
@bynary.composables.class.Function.useClass
github-actions[bot] edited this page Jul 11, 2024
·
3 revisions
@bynary/composables / @bynary/composables/class / useClass
useClass(
className
,options
?):WritableSignal
<boolean
>
Adds the given class to the host element if set to true.
• className: string
The name of the class to toggle
• options?: IUseClassOptions
A set of options
WritableSignal
<boolean
>
import { useClass } from '@bynary/composables/class';
@Component({
selector: 'my-component'
})
class MyComponent {
isLoading = useClass('loading');
}
<my-component></my-component>
This will output:
<my-component class="loading"></my-component>