Styled-components and react-bootstrap?

前端 未结 2 1442
时光取名叫无心
时光取名叫无心 2021-02-02 06:06

Is there a way to use styled-components together with react-bootstrap? react-bootstrap exposes bsClassproperties instead of className for their compone

2条回答
  •  忘了有多久
    2021-02-02 06:45

    You can extend the style keeping the original styles of the component from bootstrap. You will find more documentation on using third party libraries like react bootstrap with styled-components here.

    const StyledButton = styled(Button)`
      color: palevioletred;
      font-size: 1em;
      margin: 1em;
      padding: 0.25em 1em;
      border: 2px solid palevioletred;
      border-radius: 3px;
    `;
    

    Here is a sandbox for reference: https://codesandbox.io/s/2vpm40qk90

提交回复
热议问题