-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[CardActionArea] Add an Active Prop #44730
Comments
Thanks for the feedback but I think this should be done from the user side because the active styles are varied between projects. It could be just background, or border, or box-shadow. What we could do is adding a demo to show how to properly style the active state. Based on your code, I'd recommend this instead: <CardActionArea
onClick={() => onClick(resource)}
data-active={selected ? "" : undefined}
sx={{
'&[data-active]': {
backgroundColor: 'action.selected',
'&:hover': {
backgroundColor: 'action.selectedHover',
}
}
}}
> Do you want to open a PR? |
@siriwatknp adding this use-case to the documentation would indeed help! Can you point me to the relevant file to change? |
@aress31 See this doc for steps to add a new demo: https://github.com/mui/material-ui/blob/master/CONTRIBUTING.md#how-to-add-a-new-demo-to-the-docs |
Alright it will be quicker and easier if you guys do the PR - so I will sit it out. |
@aress31 this probably won't be prioritized from our side, so I would encourage you to work on a PR. I would be happy to guide you. |
Hi @DiegoAndai I would wanna work on this, can you please guide me on how to work on this PR? |
Please follow the contributing guide. You can add the new demo to /docs/data/material/components/cards/cards.md |
Hi @siriwatknp I have raised a PR for the issue: #44789. |
Summary
It would be great to introduce an active prop, similar to the Tabs component, for CardActionArea to support clickable Card components. Currently, my workaround looks like this:
However, adding an active prop would provide better consistency across components, especially since CardActionArea is often used for interactive cards and may need to visually indicate its active state.
Examples
See above.
Motivation
See above.
Search keywords: cardactionarea, active
The text was updated successfully, but these errors were encountered: