Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui][docs] Confusion about custom component in Grid demos #40556

Open
jlimsy opened this issue Jan 12, 2024 · 1 comment
Open

[material-ui][docs] Confusion about custom component in Grid demos #40556

jlimsy opened this issue Jan 12, 2024 · 1 comment
Labels
component: Paper This is the name of the generic UI component, not the React module! support: docs-feedback Feedback from documentation page support: question Community support but can be turned into an improvement

Comments

@jlimsy
Copy link

jlimsy commented Jan 12, 2024

Related page

https://mui.com/material-ui/react-grid/

Kind of issue

[Added by Sam: When looking at the Grid demos that use the styled() utility to define custom components, it's not immediately clear that those are not actually built-in Material UI components.]

Issue description

Your page is for Paper, but the demo code is for Box and Item. Item does not seem to work in Vite or is Item deprecated?

With

import { Grid, Item } from "@mui/material";
...
    <Grid container spacing={2}>
 <Grid item xs={3}>
        <Item>Work</Item>
    </Grid> 
...
</Grid>

I get the following error message:
The requested module '/node_modules/.vite/deps/@mui_material.js?v=b5e471c3' does not provide an export named 'Item'

Not import Item doesn't work either.

Context

I am trying to create a series of boxes in a grid for a calendar as an assignment, but Item does not work. Trying out Paper instead but them page does not explain how to increase the height of each Paper.

Search keywords: Item

@jlimsy jlimsy added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: docs-feedback Feedback from documentation page labels Jan 12, 2024
@zannager zannager added the component: Paper This is the name of the generic UI component, not the React module! label Jan 12, 2024
@samuelsycamore samuelsycamore added support: question Community support but can be turned into an improvement and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 15, 2024
@samuelsycamore
Copy link
Contributor

samuelsycamore commented Jan 15, 2024

Hey @jlimsy 👋 — as noted on the Paper doc, you're better off using Box, Stack, or another layout component rather than Paper, unless you specifically need Material Design's elevations (and if you're unsure what that is, then you probably don't need it). The Paper component's height can be adjusted with CSS, using any flavor you prefer. 😁

EDIT: sorry, I misread the post. Item is not a Material UI component. I believe you're getting it from this demo: https://mui.com/material-ui/react-grid/#basic-grid - which uses the styled() utility to create a custom component called Item that uses Paper as its basis. So when you try to import Item from the Material UI package, it doesn't work, because that component doesn't exist. Does that make sense?

@samuelsycamore samuelsycamore changed the title Item does not work [material-ui][docs] Confusion about custom component in Grid demos Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Paper This is the name of the generic UI component, not the React module! support: docs-feedback Feedback from documentation page support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

4 participants