Help migrating from styled-components #985
-
It looks like there isn't a lot of syntactic sugar for the use case of defining a component with some basic styling, especially when it has children. So, for example, I want to have const Sentence = styled.p`
margin-bottom: 1rem;
`; With panda-css I would use: const Sentence = ({ children }: { children: React.ReactNode }) => (
<styled.p marginBottom="1rem">{children}</styled.p>
); Does that sound right? It would be great if there was something more analogous to import {styledComponent} from "./styled-system/css";
const Sentence = styledComponent.p({marginBottom: "1rem"}); This would make migrating from |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey @altano, We currently support this syntax. const Sentence = styled("p", { base: { marginBottom: "1rem" } }) You can also consider using the template literal syntax mode, which allows you to do this. const Sentence = styled.p`
margin-bottom: 1rem;
`; |
Beta Was this translation helpful? Give feedback.
Hey @altano,
We currently support this syntax.
You can also consider using the template literal syntax mode, which allows you to do this.