79479860

Date: 2025-03-02 22:51:26
Score: 1
Natty:
Report link

Mantine components do not support nested inline styles out of the box. The following example will not work:

import { Button } from '@mantine/core';

function Demo() {
  return (
    <Button
      style={{
        // ✅ This works
        backgroundColor: 'hotpink',

        // ❌ This does not work
        '&:hover': { color: 'lightgreen' },
      }}
      styles={{
        root: {
          // ✅ This works
          backgroundColor: 'hotpink',

          // ❌ This does not work
          '&[data-disabled]': { color: 'lightgreen' },
          '&:hover': { color: 'lightgreen' },
          '&:focus': { color: 'lightgreen' },
          '& span': { color: 'lightgreen' },
        },
      }}
    >
      This has a hotpink background.
    </Button>
  );
}

For further details, visit this link: https://help.mantine.dev/q/nested-inline-styles

Reasons:
  • Blacklisted phrase (1): this link
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Saad Qadir