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

Unique CSS vars with makeStyles #17923

Closed
andrefcdias opened this issue Apr 22, 2021 · 1 comment
Closed

Unique CSS vars with makeStyles #17923

andrefcdias opened this issue Apr 22, 2021 · 1 comment
Assignees
Labels
Fluent UI react (v8) Issues about @fluentui/react (v8) Needs: Investigation The Shield Dev should investigate this issue and propose a fix Resolution: Soft Close Soft closing inactive issues over a certain period

Comments

@andrefcdias
Copy link
Contributor

Describe the feature that you would like added

For the Flex component, CSS vars are key into having a performant solution. However, I there is currently no way of guaranteeing the uniqueness of these variables with makeStyles, leaving it open to collision with user defined variables or even when using a Flex inside of a Flex.
Being able to use a custom CSS prop and having makeStyles guarantee the uniqueness of these props would be ideal.

Proposed usage:

const colorVar = createVar();

const useStyles = makeStyles({
  root: {
    [colorVar]: 'blue',
  },
});

...

state.style = {
  [colorVar]: 'red'
}

Result

.class {
 --unique-id: 'blue'
}
<div class="class" style="--unique-id: red" />

What component or utility would this be added to

makeStyles

Have you discussed this feature with our team, and if so, who

@layershifter

Additional context/screenshots

If we opt for a solution that generates an unique ID we need also to consider how to make sure server and client generate the same ID in SSR scenarios.

@layershifter layershifter added this to To do in Release react-components via automation Apr 22, 2021
@gouttierre gouttierre added Needs: Investigation The Shield Dev should investigate this issue and propose a fix and removed Needs: Triage 🔍 labels Jun 7, 2021
@gouttierre gouttierre assigned layershifter and unassigned tomi-msft Jun 7, 2021
@gouttierre gouttierre added the Fluent UI react (v8) Issues about @fluentui/react (v8) label Jun 7, 2021
@msft-fluent-ui-bot
Copy link
Collaborator

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.

@msft-fluent-ui-bot msft-fluent-ui-bot added the Resolution: Soft Close Soft closing inactive issues over a certain period label Nov 4, 2021
Release react-components automation moved this from To do to Done Nov 4, 2021
@microsoft microsoft locked as resolved and limited conversation to collaborators Dec 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fluent UI react (v8) Issues about @fluentui/react (v8) Needs: Investigation The Shield Dev should investigate this issue and propose a fix Resolution: Soft Close Soft closing inactive issues over a certain period
Development

No branches or pull requests

5 participants