How can I style a MUI5 Tooltip with emotion?

Shamoon

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:

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

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

Sachila Ranawaka

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I pass default theme that is provided by MUI5 and create a style for any component in MUI5?

How can I pass both the theme and the props in the styled() of MUI5?

How can I change a Bootstrap 5 tooltip color based on button style?

How can I change Xaxis tooltip style in Apexchart?

I can't import emotion js style with dynamic variable

How can I use media query with emotion/styled/macro?

How can I implement in styled components and interpolations with emotion theming?

How can I change a Bootstrap 5 tooltip background color on hover?

How can I remove this border style using MUI sx inline

reactjs: MUI5 : MobileDateTimePicker API: How to customize the text in the calendar

How to enter time as 00:00:00 in DateTimePicker in mui5

How can I center a tooltip below an element that is narrower than the tooltip?

How can i add a tooltip to menu item?

How can I centralize bootstrap tooltip call?

How can I make a form within a tooltip?

Bootstrap Tooltip - How can I access "this"

JavaFX How Can I Center a Tooltip on a Node?

How can I change Intellisense tooltip colors

How can I display a tooltip on an HTML file?

How can I remove the number in the tooltip

How can i center the tooltip above the image?

How can I hide tooltip in highcharts

How can I position the tooltip to make it responsive?

How can I style the cells of a QTableWidget in PyQt5?

Missing attribute types in Microsoft Face API (with Android). How can I use the Emotion attribute?

How to style tooltip of bootstrap 4

How to style a redux-tooltip?

How can I create a tooltip on mouse over in p5JS?

In PyQt5's QListWidget, how can I only show the tooltip for an item when the user chooses it?