Media objects

The media object helps build complex and repetitive components (e.g. blog comments, tweets, the like and more) where some media is positioned alongside content that doesn’t wrap around said media. Plus, it does this with only two required classes thanks to flexbox. Below is an example of a single media object. Only two classes are required—the wrapping Media and the Media.Body around your content. Optional padding and margin can be controlled through spacing utilities.

Media Nesting

Media objects can be infinitely nested, though we suggest you stop at some point. Place nested Media within the Media.Body of a parent media object.

Media Alignment

Media in a media object can be aligned with flexbox utilities to the top (default), middle, or end of your Media.Body content.

Media Order

Change the order of content in media objects by modifying the HTML itself, or by adding some custom flexbox CSS to set the order property (to an integer of your choosing).

Media list

Because the media object has so few structural requirements, you can also use these classes on list HTML elements. On your ul or ol , add the .list-unstyled to remove any browser default list styles, use <Media as="li"> to render as a list item. As always, use spacing utilities wherever needed to fine tune.

Props

Media

import Media from 'react-bootstrap/Media'Copy import code for the Media component
Name Type Default Description
as
elementType
<div>

You can use a custom element type for this component.

bsPrefix
string
'media'

Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css.

© 2014–present Stephen J. Collings, Matthew Honnibal, Pieter Vanderwerff
Licensed under the MIT License (MIT).
https://react-bootstrap.github.io/layout/media/