Issue
It appears that the limitation in placing ellipsis on the Card is due to the rendering of the CardHeader component in the HTML structure.
The CardHeader consists of a "root" element and a "content" element as shown below:
https://i.sstatic.net/GHLNd.jpg
The Typography component has a built-in prop for adding ellipsis, called noWrap. In order for the noWrap property to function correctly, there are two possible solutions outlined below:
Option 1
If you do not require the flex behavior of CardHeader, you can disable it by setting the display property to "block" and overflow property to "hidden":
...
cardHeader: {
display: "block",
overflow: "hidden"
}
...
<CardHeader
className={classes.cardHeader}
title={
<Typography noWrap gutterBottom variant="h6" component="h4">
A world wide web - the revolution
</Typography>
}
/>
...
Option 2
If you need to maintain the flex behavior of CardHeader, you can apply the overflow to both the root and content elements using the generated classes from the CardHeader classes property:
...
cardHeaderRoot: {
overflow: "hidden"
},
cardHeaderContent: {
overflow: "hidden"
}
...
<CardHeader
classes={{
root: classes.cardHeaderRoot,
content: classes.cardHeaderContent
}}
title={
<Typography noWrap gutterBottom variant="h6" component="h4">
A world wide web - the revolution
</Typography>
}
/>
...
You can view an example in the provided sandbox link.
Note
Please be cautious when modifying the default rendering behavior of components, as it may lead to unintended side effects across your component tree.
Final Thoughts
If you encounter any further issues, feel free to reach out to us for assistance.