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

[v5] No documented way of importing css or keyframes for styled-components #28905

Closed
2 tasks done
MonstraG opened this issue Oct 8, 2021 · 4 comments · Fixed by #29035
Closed
2 tasks done

[v5] No documented way of importing css or keyframes for styled-components #28905

MonstraG opened this issue Oct 8, 2021 · 4 comments · Fixed by #29035
Assignees
Labels
status: waiting for author Issue with insufficient information

Comments

@MonstraG
Copy link
Contributor

MonstraG commented Oct 8, 2021

As per #28657 (comment).

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

All other sections not applicable, really.

emotion has documentation for css prop: https://mui.com/guides/interoperability/#the-css-prop, but not styled-components

@MonstraG MonstraG added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 8, 2021
@eps1lon
Copy link
Member

eps1lon commented Oct 11, 2021

It doesn't look like this bug report has enough info for one of us to reproduce it.

Please provide a CodeSandbox (https://material-ui.com/r/issue-template-latest), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem.

Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

@eps1lon eps1lon added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 11, 2021
@MonstraG
Copy link
Contributor Author

MonstraG commented Oct 12, 2021

I'm guess I'm gonna copy the original comment here

import { styled } from '@mui/material';

Where should I import { css } from? Following gives me errors:

import { css } from "@mui/styled-engine";

const Container = styled("div")<{ $heightLimit: boolean }>`
	min-width: 0;

	${({ $heightLimit }) =>
		$heightLimit &&
		css`
		    height: 100vh;
		`}
`;

Gives big ts error ending in readonly SimpleInterpolation[] missing [...] from type ArrayInterpolation<some stuff here>

With styled imported like this:
import styled, { css } from "@mui/styled-engine";
it works.

But I think that results in 2 instances of name generator in the app, breaking class names in ssr

And I guess I wanna cc @mnajdova

@damianstasik
Copy link

If you want to use MUI with styled-components you will need @mui/styled-engine-sc instead of @mui/styled-engine. Both of the packages export keyframes and css.

@MonstraG
Copy link
Contributor Author

MonstraG commented Oct 13, 2021

If you want to use MUI with styled-components you will need @mui/styled-engine-sc instead of @mui/styled-engine. Both of the packages export keyframes and css.

Given the documentation:
https://mui.com/guides/styled-engine/#yarn,

I cannot import anything from @mui/styled-engine-sc because it's not technically is in the dependencies, I can only import from @mui/styled-engine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for author Issue with insufficient information
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants