Menu

From <div> to <Box>: what I learned wrestling MUI on my first real React project
πŸ“°

From <div> to <Box>: what I learned wrestling MUI on my first real React project

DEV Community: cssΒ·Tanya KletkaΒ·8 days ago
#M0iRdm1I
#devtocss#devto#dev#theme#component
Long article (2626 words) β€” no AI summary yet.
Reading 0:00
15s threshold

No more CSS, you say? Plot twist: it never left. It just changed its outfit (and not always for the best).

TL;DR

MUI components are HTML elements with a styling API attached. <Box> is a <div> , and the styles go into the sx prop.

Spacing-ish things are multiplied by 8, size-ish things are pixels, colours are names.

variant = how it looks. component = which HTML tag renders.

Theme for identity, sx for layout.

Anything marked (ours) is a rule of our project's theme, not a MUI default.

When we started working on Poolaki , a shared expense tracker we built as our 42 Berlin graduation project, I knew HTML and CSS reasonably well. I could centre a div (eventually).…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.