Skip to content

Best way to add extra styles to a React component #899

Discussion options

You must be logged in to vote

Nevermind, I found the solution, just need to use the className prop!

import { styled } from "./stitches.config";
import "./styles.css";

const SomeButton = function ({ className }) {
  return <button className={className}>Bar</button>;
};

const ButtonWithMargin = styled(SomeButton, {
  marginLeft: "1rem"
});

export default function App() {
  return (
    <div>
      <span>Foo</span>
      <ButtonWithMargin />
    </div>
  );
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by funwithtriangles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant