Skip to content

Commit

Permalink
docs(composables/class): add example
Browse files Browse the repository at this point in the history
  • Loading branch information
homj committed Nov 18, 2023
1 parent 87944d5 commit 59358e2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libs/composables/class/src/provide-base-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,24 @@ export const BASE_CLASS = new InjectionToken<string>('@bynary/composables/class.

/**
* Provide a base CSS class that should be applied to a host.
* The base class can be injected using the {@link BASE_CLASS} token.
* This token will be used by {@link useModifier} and {@link useModifierGroup} to generate modifier classes.
*
* @see useModifier
* @see useModifierGroup
*
* @example
* ```ts
* @Component({
* selector: 'my-component',
* providers: [
* provideBaseClass('my-component')
* ]
* })
* class MyComponent {
* baseClass = inject(BASE_CLASS); // 'my-component'
* }
*
* @param baseClass - The base class to provide.
*/
export const provideBaseClass = (baseClass: string) => ({
Expand Down

0 comments on commit 59358e2

Please sign in to comment.