Skip to content
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

The <Radio/> component does not receive padding when a value of 0 is passed into the label prop. #4746

Closed
qaynam opened this issue Sep 11, 2023 · 0 comments

Comments

@qaynam
Copy link
Contributor

qaynam commented Sep 11, 2023

What package has an issue

@mantine/core

Describe the bug

When the number 0 is passed to the label props of the Radio component, it is treated as false and the padding does not work.

import { Box, Flex, Group, MantineProvider, Radio } from "@mantine/core";

export default function App() {
  return (
    <MantineProvider withGlobalStyles withNormalizeCSS>
      <Box sx={{
        padding: 10
      }}>
      <Group>{Array.from({length: 10}).map((_, i) => (
        <Radio key={i} label={i} value={i}/>
      ))}
      </Group>
      </Box>
    </MantineProvider>
  );
}

image

What version of @mantine/hooks page do you have in package.json?

6.0.20

If possible, please include a link to a codesandbox with the reproduced problem

https://codesandbox.io/s/blissful-jerry-l29nwm

Do you know how to fix the issue

Yes

Are you willing to participate in fixing this issue and create a pull request with the fix

Yes

Possible fix

change this line

to this

{label != null && (
  <label className={classes.label} data-disabled={disabled || undefined} htmlFor={id}>
    {label}
  </label>
 )}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants