solid-styled-components
solid-styled-components copied to clipboard
feat: add `attrs` prop composition API
Have you considered adding styled components composition attrs API?
Example for this library.
import styled from "solid-styled-components"
const First = styled("div").attrs((props: { size: number }) => ({
weight: Math.max(100, Math.min(1000, size))
})`
font-weight: ${props => props.weight};
`
const First = styled("div").attrs({
weight: 500
})`
font-weight: ${props => props.weight};
`
It's great for adding default or derived props that apply to element attributes.
I may be able to provide the PR.