solid-styled-components icon indicating copy to clipboard operation
solid-styled-components copied to clipboard

feat: add `attrs` prop composition API

Open waynevanson opened this issue 11 months ago • 0 comments

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.

waynevanson avatar Jan 20 '25 22:01 waynevanson