mui / mui/material-ui

[system] Support using `applyStyles` inside template literals

Open
#44,659 0 comments 0 reactions 1 assignee View on GitHub

@DiegoAndai is already working on this.

Since Dec 5, 2024.

scope: system type: enhancement waiting for 👍
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

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 https://github.com/mui/material-ui/issues/44488

Search keywords: applyStyles template literals

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.