How can i pass props to pseudo element?
See original GitHub issueDescription:
I want to pass props to the after element, But i have an error… I found all documents, but i cant solve my issue
interface Time {
time: number
}
const Bubble = styled<'div', Time>('div')`
display: inline-block;
position: relative;
background: rgba(104, 127, 209, 0.5);
color: rgba(255, 255, 255, 0.9);
border-radius: 5px;
padding: 9px;
margin-top: 9px;
line-height: 15px;
&:first-of-type {
&:before {
content: '';
position: absolute;
top: 20%;
left: -9px;
width: 0;
height: 0;
border-top: 0px solid transparent;
border-radius: 1px 0 0 0;
border-bottom: 12px solid transparent;
border-right: 9px solid rgba(104, 127, 209, 0.5);
}
}
&:last-of-type {
&:after {
content: ${props => `${props.width}%`};
position: absolute;
left: 100%;
}
}
`
i cant find after
element.
Documentation links:
Can I refer to this document?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Using Styled Components and passing props to psedo ...
I have the follwing styled component, I am trying to pass a prop to it and use it in a pseudo element selector,...
Read more >Pseudo-elements - CSS: Cascading Style Sheets | MDN
A CSS pseudo-element is a keyword added to a selector that lets you style a specific part of the selected element(s).
Read more >How to make reusable components with pseudo-selectors
By default, it uses the string "button" as its type — but by passing an as prop, you can set that to "a"...
Read more >API Reference - styled-components
If you want to prevent props meant to be consumed by styled components from being passed to the underlying React node or rendered...
Read more >PseudoBox - Chakra UI | Design System built with React
For example, to style &:hover , use the _hover prop and pass the style props. We use the underscore _ notation to visually...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kud
I closed the issue because it was my mistake. 😅 Here’s example.
Yeah I was trying this:
Apparently the
'
were missing. Thank you!