I am trying to create a Storybook using the Angular Material library in an nx
app but I can't get the styles to appear that come along with the library. So the component renders but there are no styles along with it. I've added the component to Storybook like so:
export default {
title: 'Buttons',
component: ButtonComponent,
decorators: [
moduleMetadata({
imports: [
MatButtonModule
],
}),
]
} as Meta<ButtonComponent>;
This screenshot shows the Primary Button but doesn't get the correct purple styling.
How do I go about getting something like this import into Storybook so the theme comes through?
@import '@angular/material/prebuilt-themes/deeppurple-amber.css';
This is also an nx
app so there is no angular.json
, but a project.json
and a workspace.json
. I have try adding the theme to project.json
as I have below but doesn't work, I would assume it needs to passed to storybook directly somehow and not inside of the project.json (which would apply to the app itself and not storybook)?
"build": {
"options": {
"styles": [
"node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css"
],
"scripts": []
}
},
Using Angular Material "13.2.3"
, "@nrwl/storybook": "13.8.3"
, and then these additional libraries:
"@storybook/addon-essentials": "6.5.0-alpha.41",
"@storybook/addon-knobs": "6.4.0",
"@storybook/addons": "^6.5.0-alpha.41",
"@storybook/angular": "6.5.0-alpha.41",
"@storybook/api": "6.5.0-alpha.41",
"@storybook/builder-webpack5": "6.5.0-alpha.41",
"@storybook/core-server": "6.5.0-alpha.41",
"@storybook/manager-webpack5": "6.5.0-alpha.41",
Any help is much appreciated!