beyond20g5
beyond20g5

Reputation: 103

Material-UI include only certain component

I just want to include material ui dialogs in my project. I do not want to include other components in my project. So I don't want to install full material ui just to use dialogs. Can anyone help with this?

https://material-ui.com/components/dialogs/

Upvotes: 8

Views: 1299

Answers (1)

tao
tao

Reputation: 90148

According to the documentation,

Tree-shaking of Material-UI works out of the box in modern frameworks. Material-UI exposes its full API on the top-level @material-ui import.

Which means importing exactly what you're using will not result into the inclusion of other parts of @material-ui/ in your production build.

Note all of their examples import only the bits used in that particular example, so figuring out what your project needs for each case should not be difficult. Besides, whenever you're missing something, you'll get a descriptive error message about it, telling you exactly what you missed.

Upvotes: 3

Related Questions