Skip to content

v5.12.3

Compare
Choose a tag to compare
@mnajdova mnajdova released this 02 May 15:07
· 2661 commits to master since this release
9710ff3

May 2, 2023

A big thanks to the 18 contributors who made this release possible. Here are some highlights ✨:

  • all planned breaking changes for Base UI are done. The first beta release should come next week 🎉
  • 🐛 bug fixes and 📚 documentation improvements.

@mui/material@5.12.3

@mui/joy@5.0.0-alpha.78

@mui/base@5.0.0-alpha.128

Breaking changes

  • The component prop is no longer supported because it can be replaced with the slots API. This is how the transformation will look like:

     <Button
    -  component="span"
    +  slots={{ root: "span" }}
     />

    If using TypeScript, the custom component type should be added as a generic on the Button component.

    -<Button
    +<Button<typeof CustomComponent>
       slots={{ root: CustomComponent }}
       customProp="foo"
     />

    There is codemod that you can run in your project to do the transformation:

    npx @mui/codemod v5.0.0/base-remove-component-prop <path>

    The full documentation about the codemod can be found here.

    This is the list of PR related to this change:

  • ​[base] Improve API consistency (#36970) @michaldudak

    Brought consistency to Base UI components and hooks' parameters and return values:

    1. Whenever a hook needs a ref, it's now called <slot_name>Ref, which matches the get<slot_name>Props in the return value.
    2. All hooks that accept external refs now return merged refs, making combining multiple hooks on one element easier. This was proven necessary in several compound components (like menuItem being both a button and a list item). The type of this value is React.RefCallback as using the more general React.Ref caused variance issues.
    3. Type of accepted refs is standardized to React.Ref<Element>
    4. Naming and typing of the forwarded ref in unstyled components were standardized - it's forwardedRef: React.ForwardedRef (unless a more specific type is needed).
    5. The shape of the definition of unstyled components was standardized - it's React.forwardRef(function Component(props: Props, forwardedRef: React.Ref) { ... });. Specifically, the generic parameters of forwardRef were removed as they are specified in function arguments.

Changes

  • ​[FormControl][base] Do not use optional fields in useFormControlContext's return value (#37037) @michaldudak

Docs

Core

All contributors of this release in alphabetical order: @cherniavskii, @DavidBoyer11, @hbjORbj, @jakub-stastny, @joserodolfofreitas, @maxdestors, @michaldudak, @mj12albert, @mnajdova, @navedqb, @nicolas-ot, @oliviertassinari, @PunitSoniME, @sai6855, @samuelsycamore, @siriwatknp, @varunmulay22, @ZeeshanTamboli