Borders

React Bootstrap 5 Borders component

Use border utilities to quickly style the border and border-radius of an element. Great for images, buttons, or any other element.


Basic examples

Use border utilities to add or remove an element’s borders. Choose from all borders or one at a time.

Additive

Additive classes are used to add borders.

        
            
            import React from 'react';
              
            export default function App() {
              return (
                <>       
                  <span class="square border"></span>
                  <span class="square border-top"></span>
                  <span class="square border-end"></span>
                  <span class="square border-bottom"></span>
                  <span class="square border-start"></span>
                </>
              );
            }
            
        
    

Subtractive

Subtractive classes are those that are used to remove borders.

        
            
          import React from 'react';
                  
          export default function App() {
            return (
              <>       
                <span class="square border border-0"></span>
                <span class="square border border-top-0"></span>
                <span class="square border border-end-0"></span>
                <span class="square border border-bottom-0"></span>
                <span class="square border border-start-0"></span>
              </>
            );
          }
          
        
    

Color

Change the border color using utilities built on our theme colors.

        
            
          import React from 'react';
                  
          export default function App() {
            return (
              <>       
                <span class="square border border-primary"></span>
                <span class="square border border-secondary"></span>
                <span class="square border border-success"></span>
                <span class="square border border-danger"></span>
                <span class="square border border-warning"></span>
                <span class="square border border-info"></span>
                <span class="square border border-light"></span>
                <span class="square border border-dark"></span>
                <span class="square border border-white"></span>
              </>
            );
          }
          
        
    

Width

Change the border width.

        
            
          import React from 'react';
                   
          export default function App() {
            return (
              <>       
                <span class="square border border-1"></span>
                <span class="square border border-2"></span>
                <span class="square border border-3"></span>
                <span class="square border border-4"></span>
                <span class="square border border-5"></span>
              </>
            );
          }
          
        
    

Border-radius

Add classes to an element to easily round its corners.

        
            
          import React from 'react';
               
          export default function App() {
            return (
              <>       
                <span class="square bg-primary rounded"></span>
                <span class="square bg-primary rounded-top"></span>
                <span class="square bg-primary rounded-end"></span>
                <span class="square bg-primary rounded-bottom"></span>
                <span class="square bg-primary rounded-start"></span>
                <span class="square bg-primary rounded-circle"></span>
                <span class="square bg-primary rounded-pill" style="width: 150px"></span>
                <span class="square bg-primary rounded-0"></span>
              </>
            );
          }
          
        
    

Sizes

Use the scaling classes for larger or smaller rounded corners. Sizes range from 0 to 3, and can be configured by modifying the utilities API.

        
            
          import React from 'react';
          
          export default function App() {
            return (
              <>       
                <span class="square bg-primary rounded-0"></span>
                <span class="square bg-primary rounded-1"></span>
                <span class="square bg-primary rounded-2"></span>
                <span class="square bg-primary rounded-3"></span>
              </>
            );
          }