Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I style a MUI5 Tooltip with emotion?

I read through https://stackoverflow.com/a/69821680/239879 and tried the styled method. I have:

import * as React from 'react';
import { styled } from '@mui/material/styles';
import Tooltip, { TooltipProps, tooltipClasses } from '@mui/material/Tooltip';


const ToBeStyledTooltip = ({ className, ...props }: TooltipProps) => (
  <Tooltip { ...props } classes = {{ tooltip: className }} />
);
const StyledTooltip = styled(ToBeStyledTooltip)(({ theme }) => ({
  backgroundColor: '#f5f5f9',
  color: 'rgba(0, 0, 0, 0.87)',
  maxWidth: 220,
  border: '1px solid #dadde9',
}));

But TypeScript gives me an error:

'Tooltip' refers to a value, but is being used as a type here. Did you mean 'typeof Tooltip'?

And when I do a build, I get:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

10:11  Error: Parsing error: '>' expected.

Not sure what is different about my setup. Any help would be appreciated.

>Solution :

Make sure you’re on a .tsx or .jsx file and not a .ts, .js file –

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading