According to Angular Material Documentation it's required to include entire theme for the framework to work correctly. Obviously, entire theme contains styles for all components.
However, I'm building component library and pulling only specific component from Angular Material. Based on that, I need an ability to include only styles for the individual component.
Is there way to include styles for a particular component ?
I understand there might be a solution to go and grab styling from the source, but it would be preferable to have more "organic" approach which encapsulates the implementation and will reflect changes in my component when Angular Material will be updated.
At the time of asking you could probably just do:
@import '~@angular/material/theming';
@include mat-button-theme($custom-theme);
to only get the CSS for the button included in your bundle. At the time of writing this answer (Angular Material v16) you can do:
@use '@angular/material' as mat;
@include mat.slider-theme($custom-theme);
Late answer but maybe useful to some.