mantinedev / mantine

A fully featured React components library
https://mantine.dev
MIT License
26.75k stars 1.89k forks source link

Size prop is sometimes ignored in Title component #6827

Closed kimfucious closed 1 month ago

kimfucious commented 1 month ago

Dependencies check up

What version of @mantine/* packages do you have in package.json?

7.12.12

What package has an issue?

@mantine/core

What framework do you use?

Next.js

In which browsers you can reproduce the issue?

All

Describe the bug

When using the Title component the size prop does not seem to be respected.

I'm specifically trying to use an H2 Header with a smaller font-size.

<Title order={2} size="h5">H2 with h5 font-size</Title>

I've listed the below as a demonstration, knowing that some of these would never be used.

I could very well be doing something wrong, or misunderstanding what the size prop does, but this seems pretty straight forward.

<Title order={1} size="h5">H1 with h5 font-size</Title>
<Title order={1}>H1 without size prop</Title>
<Title order={2} size="h5">H2 with h5 font-size</Title>
<Title order={2}>H2 without size prop</Title>
<Title order={3} size="h5">H3 with h5 font-size</Title>
<Title order={3}>H3 without size prop</Title>
<Title order={4} size="h5">H4 with h5 font-size</Title>
<Title order={4}>H4 without size prop</Title>
<Title order={5} size="h5">H5 with h5 font-size</Title>
<Title order={5}>H5 without size prop</Title>
<Title order={6}>H6 with h5 font-size</Title>
<br/>
<Title order={2} size="h1">H2 with h1 font-size</Title>
<Title order={2} size="h2">H2 with h2 font-size</Title>
<Title order={2} size="h3">H2 with h3 font-size</Title>
<Title order={2} size="h4">H2 with h4 font-size</Title>
<Title order={2} size="h5">H2 with h5 font-size</Title>
<Title order={2} size="h6">H2 with h6 font-size</Title>
<br/>
<Title order={2} size="xs">H2 with xs font-size</Title>
<Title order={2} size="sm">H2 with sm font-size</Title>
<Title order={2} size="md">H2 with md font-size</Title>
<Title order={2} size="lg">H2 with lg font-size</Title>
<Title order={2} size="xl">H2 with xl font-size</Title>

image

If possible, include a link to a codesandbox with a minimal reproduction

No response

Possible fix

No response

Self-service

Kenzo-Wada commented 1 month ago

I could not reproduce it in my environment, can you provide a sandbox that will reproduce it?

I tried the exact same code in mantine's storybook and it was properly styled. Also, you cannot assign 'md' etc. to size. If you want to do that, it would be fz or something.

Screenshot from 2024-09-17 21-45-55

kimfucious commented 1 month ago

Thanks, @Kenzo-Wada.

Your helpful reply caused me to dig deeper and I discovered that RFS was preventing the size prop from working properly.

RFS is nice, but I'll probably do away with it, as using the size prop has more value for me.