Skip to content

[material-ui][BottomNavigationAction] Add slots and slotProps #45776

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

Merged
merged 7 commits into from
Apr 11, 2025

Conversation

sai6855
Copy link
Contributor

@sai6855 sai6855 commented Apr 1, 2025

@mui-bot
Copy link

mui-bot commented Apr 1, 2025

Netlify deploy preview

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

BottomNavigationAction: parsed: +2.35% , gzip: +2.16%

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 8b4e3cd

@sai6855 sai6855 added component: bottom navigation This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material enhancement This is not a bug, nor a new feature labels Apr 1, 2025
@sai6855 sai6855 requested a review from Copilot April 1, 2025 05:01
@sai6855 sai6855 marked this pull request as draft April 1, 2025 05:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for slots and slotProps for the BottomNavigationAction component, allowing customization of its internal structure. Key changes include:

  • Introducing a CustomButtonBase for testing slot behavior.
  • Updating BottomNavigationAction to use the useSlot utility for managing root and label slots.
  • Extending prop types to include new slots and slotProps definitions.

Reviewed Changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.

File Description
packages/mui-material/src/BottomNavigationAction/BottomNavigationAction.test.js Adds a custom button for slot testing and passes custom slots to the conformance tests.
packages/mui-material/src/BottomNavigationAction/BottomNavigationAction.js Integrates the useSlot utility to support slot-based customization and adds corresponding prop types.
Files not reviewed (2)
  • docs/pages/material-ui/api/bottom-navigation-action.json: Language not supported
  • docs/translations/api-docs/bottom-navigation-action/bottom-navigation-action.json: Language not supported
Comments suppressed due to low confidence (1)

packages/mui-material/src/BottomNavigationAction/BottomNavigationAction.test.js:27

  • [nitpick] Consider adding tests that explicitly validate the behavior of slotProps for both root and label slots to ensure the expected props are forwarded correctly.
slots: {

@sai6855 sai6855 requested a review from siriwatknp April 1, 2025 05:27
@sai6855 sai6855 marked this pull request as ready for review April 1, 2025 05:34
};

const [RootSlot, rootProps] = useSlot('root', {
elementType: BottomNavigationActionRoot,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elementType: BottomNavigationActionRoot,
shouldForwardComponentProp: true,
elementType: BottomNavigationActionRoot,

The BottomNavigationActionRoot comes from a ButtonBase.

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small request

@sai6855 sai6855 requested a review from siriwatknp April 9, 2025 10:54
@sai6855 sai6855 added v6.x needs cherry-pick The PR should be cherry-picked to master after merge labels Apr 11, 2025
@sai6855 sai6855 merged commit 765367d into mui:master Apr 11, 2025
24 checks passed
Copy link

Cherry-pick PRs will be created targeting branches: v6.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: bottom navigation This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature needs cherry-pick The PR should be cherry-picked to master after merge package: material-ui Specific to @mui/material v6.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants