Search code examples
angularangular-material

How can I download only one Angular Material component and not the entire library?


I need to use Angular Material only the DatePicker component for a project that I'm doing with latest version of Angular.

Can I download only one Material component or do I have to download the entire library to be able to use it?

I look forward to your help, thanks.


Solution

  • You need to install the entire library, but only import what you use.

    You install the entire library by running ng add @angular/material. However, in your module, you only include the components you need. So your module would only import MatDatepickerModule and not all the components.