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

[system] Support using applyStyles inside template literals #44659

Open
DiegoAndai opened this issue Dec 5, 2024 · 0 comments
Open

[system] Support using applyStyles inside template literals #44659

DiegoAndai opened this issue Dec 5, 2024 · 0 comments
Assignees
Labels
enhancement This is not a bug, nor a new feature package: system Specific to @mui/system waiting for 👍 Waiting for upvotes

Comments

@DiegoAndai
Copy link
Member

DiegoAndai commented Dec 5, 2024

Summary

This should be supported out of the box:

const theme = createTheme({});

const StyledButton = styled('button')`
  ${theme.applyStyles(
    'dark', `
      background: white;
    `
  )}
`;

But it's not because theme.applyStyles returns an object. The current workaround is to override applyStyles.

Motivation

Taken from #44488

Search keywords: applyStyles template literals

@DiegoAndai DiegoAndai added waiting for 👍 Waiting for upvotes package: system Specific to @mui/system enhancement This is not a bug, nor a new feature labels Dec 5, 2024
@DiegoAndai DiegoAndai self-assigned this Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is not a bug, nor a new feature package: system Specific to @mui/system waiting for 👍 Waiting for upvotes
Projects
None yet
Development

No branches or pull requests

1 participant