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

[Feature]: Support custom style hook "inheritance" #30308

Closed
1 task done
spmonahan opened this issue Jan 12, 2024 · 1 comment
Closed
1 task done

[Feature]: Support custom style hook "inheritance" #30308

spmonahan opened this issue Jan 12, 2024 · 1 comment
Labels
Fluent UI react-components (v9) Resolution: Soft Close Soft closing inactive issues over a certain period Type: Feature

Comments

@spmonahan
Copy link
Contributor

Library

React Components / v9 (@fluentui/react-components)

Describe the feature that you would like added

I want nested FluentProviders to be able to inherit their parent FluentProviders' custom style hooks.

For example:

const outerCustomStyles = {
  useButtonStyles: (state: ButtonState) => {
    state.root.className = mergeClasses(state.root.className, "color: pink, border: red");
  }
};

const innerCustomStyles = {
  useButtonStyles: (state: ButtonState) => {
    state.root.className = mergeClasses(state.root.className, "border: blue");
  }
};

<FluentProvider customStyleHooks={outerCustomStyles}>
  <Button>With pink text and a red border</Button>
   <FluentProvider customStyleHooks={innerCustomStyles} inheritParentCustomStyles>
      <Button>With pink text and a blue border</Button>
   </FluentProvider>
</FluentProvider>

Live example (note this shows the current "issue", i.e., it doesn't work as requested)

Have you discussed this feature with our team

@micahgodbolt

Additional context

Today style inheritance doesn't work as requested but nested FluentProviders do inherit customizations so long as they themselves do not add futher customization. So if the parent customizes Button and the child does not, all the parent customizations will render in the child. If the child customizes Button as well none of the parent customizations will render in the child.

This creates a somewhat strange state of affairs in that "inheritance" seems to work in some cases and then not at all in others which is likely to be confusing to users.

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Priority

Normal

Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes.

Still require assistance? Please, create a new issue with up-to date details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fluent UI react-components (v9) Resolution: Soft Close Soft closing inactive issues over a certain period Type: Feature
Projects
None yet
Development

No branches or pull requests

2 participants