How to pass padding/margin as props in React-Bootstrap components

前端 未结 6 1531
闹比i
闹比i 2021-02-15 11:09

I am trying to apply margins and paddings with React-Bootstrap as props.

I passed the docs through but haven\'t found any mention adding padding or margin in there as it

6条回答
  •  遇见更好的自我
    2021-02-15 11:47

    First include bootstrap CSS in your src/index.js or App.js

    import 'bootstrap/dist/css/bootstrap.min.css';
    

    Then you can style your component by passing desired bootstrap CSS class name as className prop in React, for example:

    import React from "react"
    import Container from "react-bootstrap/Container";
    
    function MyComponent() {
      return (
        
          
        
      );
    }
    
    export default MyComponent
    

    Above code will add p-0 CSS class to Container.

    Reference

    React - How do I add CSS classes to components?

    React-Bootstrap - Stylesheets

提交回复
热议问题