Coder Social home page Coder Social logo

Comments (2)

samuelsycamore avatar samuelsycamore commented on April 28, 2024 4

Thanks for the feedback @thuphan27379 ! I completely agree that the docs are lacking when it comes to describing the use cases for these components. In fact, I'm currently in the process of revising the Box page (#40622) and the Container page (#41074), and I'll plan on revising Grid and Stack next!

To quickly answer your questions as best as I can:

  • Use Container for the top level wrapper of the app—in other words, it should sit close to the app's <body> tag, and like <body>, there should be only one
  • Use Grid inside your Container to arrange Boxes and Stacks into a layout
  • Use Stack as a wrapper to arrange content along the horizontal or vertical axis
  • Use Box for all other generic wrapping purposes—like a <div> that has access to your theme and other MUI-specific features
    • Because Box is a generic wrapper, you could also put a Grid or a Stack inside of one—but it would be strange to put a Container inside of a Box, because the Container is meant to be at the top of the DOM tree
  • You can put a <div> inside of any of these components, as needed—the main benefit of using layout components instead of plain HTML is that you get access to additional customization tools (props, theme tokens)

I hope that helps! Please feel free to ask more questions if you have any—it will help us to better revise these docs for everyone else.

from material-ui.

thuphan27379 avatar thuphan27379 commented on April 28, 2024

thanks alot!

from material-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.