@hal.littel
To add a class to an Angular component in Storybook, you can follow these steps:
- First, make sure you have Storybook set up in your Angular project. If you haven't already, you can follow the official documentation to set up Storybook in your Angular project.
- Once Storybook is set up, navigate to the .stories.ts file of the component you want to add a class to.
- In the args object of the component story, add a property for the class you want to apply. For example:
1
2
3
4
5
6
|
export const Default = () => ({
component: YourComponent,
props: {
class: 'your-custom-class',
},
});
|
- In your component template (.html file), you can apply the class by binding the class property to the class attribute. For example:
1
|
<div [class]="class">Your content here</div>
|
- Restart Storybook to see the changes applied. Your Angular component in Storybook should now have the added custom class.
By following these steps, you should be able to add a class to an Angular component in Storybook successfully.