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

[material-ui] Fix slots typing for Tooltip and StepLabel #44985

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Jan 10, 2025

closes #44637

Root cause

The previous slots types is too narrow

export interface StepLabelSlots {
  /**
   * The component to render in place of the [`StepIcon`](https://mui.com/material-ui/api/step-icon/).
   */
  stepIcon: React.ElementType<StepIconProps>;
}

It's specific to StepIconProps, meaning using plain HTML like "div" or a custom component won't work.

<StepLabel
  slots={{
    stepIcon: 'div', // ❌ type error
  }}
>
  Step One
</StepLabel>;

Fix

Widening the types to just React.ElementType to include plain HTML and any custom React component.


@siriwatknp siriwatknp added component: stepper This is the name of the generic UI component, not the React module! typescript component: tooltip This is the name of the generic UI component, not the React module! labels Jan 10, 2025
@mui-bot
Copy link

mui-bot commented Jan 10, 2025

Netlify deploy preview

https://deploy-preview-44985--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against e1faf76

@aarongarciah
Copy link
Member

@siriwatknp I think you wanted to link this issue in the PR description #44952

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: stepper This is the name of the generic UI component, not the React module! component: tooltip This is the name of the generic UI component, not the React module! typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants