Skip to content

feature request: flag props that don't need to be propagated with '$' #34

Open

Description

@illiaChaban

styled components is awesome, but one problem it has is that it propagates all props to the html elements .
For example, if I have a prop specific to styling like "size", it will be propagated to HTML:

import { render } from "solid-js/web";
import { styled } from "solid-styled-components";

const MyComponent = styled("div")`
  background: black;
  width: ${(props: { size: number }) => props.size}px;
  height: ${(props) => props.size}px;
`;

render(() => <MyComponent size={40} />, document.getElementById("app")!);

sandbox link

image

I'd like to avoid this. This library solved this problem by marking all props that shouldn't be propagated with "$" symbol. So my "size" prop would become "$size". Same goes for $theme and $as props. IMO it's a clear and concise solution.

Activity

  1. blarfoon commented on Oct 4, 2022

    @blarfoon

    up, I would love this issue to move forward. Is anyone currently working on it? If not, I might be able to pick this up and open a PR in a few weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions