question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@emotion/styled: Add Transient Props

See original GitHub issue

The problem

In 5.1.0, styled-components introduced transient props. Props prefixed with a dollar sign ($) are “mark[ed] as transient and styled-components knows not to add it to the rendered DOM element or pass it further down the component hierarchy”.

Proposed solution

This would be useful functionality to support – I am exploring migrating from styled-components to @emotion/styled.

Alternative solutions

None suggested. The intent is to follow this implementation detail introduced by another CSS-in-JS project.

Additional context

Material UI v4 -> v5 is migrating to emotion, and my project uses styled-components today. I’m trying to get my codebase to coalesce around a single CSS in JS solution, and the fewer the API differences there are, the lower the barrier to migration is.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:77
  • Comments:46 (11 by maintainers)

github_iconTop GitHub Comments

45reactions
v1kt0r1337commented, Jan 24, 2022

Transient props would be appreciated.

37reactions
WilliamHoangUKcommented, Nov 4, 2021

I’ve recently migrated a project I’m working on to MUI v5 and started using emotion for the first time. Came to this thread after noticing an error about receiving a boolean value for a non-boolean attribute and was hoping for a neat solution to deal with it. Came across this for styled-components, and was hoping for similar functionality for emotion. I echo the sentiments of others who don’t want to have to explicitly filter out props that we don’t want to pass to the DOM.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Attaching Props - Emotion
Some css-in-js libraries offer APIs to attach props to components, instead of having our own API to do that, we recommend creating a...
Read more >
mui/system -- how to pass transient props to styled()
I'm using import { styled } from "@mui/system" ; like so: const Column = styled("div")<ColumnProps>` background: ${(props) => props. ...
Read more >
emotion/styled: Add Transient Props - Bountysource
@emotion/styled: Add Transient Props ... In 5.1.0, styled-components introduced transient props. Props prefixed with a dollar sign ( $ ) are "mark ...
Read more >
Removing props from HTML elements - Styled System
Emotion has first-class support in its API for determining which props are forwarded to the HTML element with its shouldForwardProp API. Styled System...
Read more >
Introducing “transient” props - Medium
If you use a higher order component (HOC) library like styled-components, you've likely run into the pain of dealing with your props vs ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found