Closed ivan-kleshnin closed 2 years ago
There's an inherit
property but it has a higher priority than size
so it's rather a hard reset.
It's possible to override Text
but it's a lot of code and you'll makes things messy with names and imports.
...
export const Text: TextComponent = React.forwardRef(({size, sx, ...rest}: TextProps<"div">, ref: PolymorphicRef<"div">) => {
sx = size ? sx : {fontSize: "inherit", ...sx} // !!!
return <Mantine.Text
{...rest}
ref={ref}
size={size}
sx={sx}
/>
}) as any
<MantineProvider
defaultProps={{
Text: {sx: {fontSize: "inherit"}}, // -- will have more priority than size
}}
<MantineProvider
defaultProps={{
Anchor: {size: "inherit"}, // -- replace the initial "md" setting
Text: {size: "xxx"}, // -- any unexpected non-undefined value will have the same effect
}}
I don't think it's meant to inherit the size, just pass the size
property to the Anchor and it should work as expected.
Fixed in 5.0
What package has an issue
@mantine/core
Describe the bug
Anchor
component is hardcoded to be ofmd
size by default.When it's used within an context of resized text (
h1/Title
, resizedText
, etc) it continues to have its own (md) size and each time should be corrected manually.Pls. check the Sandbox.
In which browser did the problem occur
All
Do you know how to fix the issue
No response
Are you willing to participate in fixing this issue and create a pull request with the fix
No response
Possible fix
font-weight
behaves correctly.font-size
should inherit parent size by default in the same way.Same problem with
Text
. Mantine typography components are not composable 😨MUI Sandbox. Default behavior is to inherit which preserves composability. Related discussion: https://github.com/mui/material-ui/issues/16110