mui / mui/material-ui

[joy-ui][Card] Make orientation Responsive

Open
#40,904 5 comments 8 reactions 1 assignee View on GitHub

@siriwatknp is already working on this.

Since Feb 5, 2024.

on hold package: joy-ui scope: card type: new feature waiting for 👍
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Summary

I ended up in a situation where doing this:

<Card orientation={{xs: "vertical", md: "horizontal"}}>
	<NarrowContent/>
	<Divider />
	<WideContent/>
</Card>

would achieve result I want, that's about it.

Whilst writing this I thought that I would do it like I used to with useMediaQuery but turns out it's not in joy - https://github.com/mui/material-ui/issues/35037, so I guess I'll copy-paste content and display-hide/block it for now.

update: tried to extract content into it's own <MyCardContent/>:

<Card orientation="horizontal" sx={{ display: { xs: "none", md: "flex" } }}>
	<MyCardContent />
</Card>
<Card orientation="vertical" sx={{ display: { xs: "flex", md: "none" } }}>
	<MyCardContent />
</Card>

and that kinda failed because <Divider/> stopped behaving because it's no longer a direct child of Card, I'm kind of at a loss what to do.

Examples

No response

Motivation

No response

Search keywords: joy card orientation vertical horizontal responsive mobile desktop

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.