Media object

React Bootstrap 5 Media object - free examples & tutorial

Responsive React Media objects built with the latest Bootstrap 5. Dedicated for highly repetitive components like blog comments, tweets, and the like.

Bootstrap 5 does not provide ready-to-use Media Objects (such as in Bootstrap 4), but you can easily reconstruct it using the Flexbox functionalities.


Basic example

A simple media object with an avatar image on the left side - ideal for testimonials / reviews, profile card or for a newsfeed post.

John Doe
John Doe Posted on February 19, 2021

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

        
            
              import React from 'react';
      
              export default function App() {
                return (
                  <div className='d-flex'>
                    <img
                      src='https://mdbcdn.b-cdn.net/img/new/avatars/2.webp'
                      alt='John Doe'
                      className='me-3 rounded-circle'
                      style={{ width: '60px', height: '60px' }}
                    />
                    <div>
                      <h5 className='fw-bold'>
                        John Doe
                        <small className='text-muted'>Posted on February 19, 2021</small>
                      </h5>
                      <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
                        dolore magna aliqua.
                      </p>
                    </div>
                  </div>
                );
              }
            
        
    

Nesting

Nesting media objects comes very handy, when you need to create a layout for comments or a chat app.

John Doe
John Doe Posted on February 19, 2021

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Anna Doe
Anna Doe Posted on February 19, 2021

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

        
            
              import React from 'react';
      
              export default function App() {
                return (
                  <div className='d-flex'>
                    <img
                      src='https://mdbcdn.b-cdn.net/img/new/avatars/2.webp'
                      alt='John Doe'
                      className='me-3 rounded-circle'
                      style={{ width: '60px', height: '60px' }}
                    />
                    <div>
                      <h5 className='fw-bold'>
                        John Doe
                        <small className='text-muted'>Posted on February 19, 2021</small>
                      </h5>
                      <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
                        dolore magna aliqua.
                      </p>
                      <div className='d-flex mt-4'>
                        <img
                          src='https://mdbcdn.b-cdn.net/img/new/avatars/4.webp'
                          alt='Anna Doe'
                          className='me-3 rounded-circle'
                          style={{ width: '60px', height: '60px' }}
                        />
                        <div>
                          <h5 className='fw-bold'>
                            Anna Doe
                            <small className='text-muted'>Posted on February 19, 2021</small>
                          </h5>
                          <p>
                            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
                            labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
                            eiusmod tempor incididunt ut labore et dolore magna aliqua.
                          </p>
                        </div>
                      </div>
                    </div>
                  </div>
                );
              }