ba-media-object
Used to show some media and content side by side
Airframe
Web Components
React
React Native
Anatomy
Media
The icon or image placed in the media slot, positioned to the left of the content
Content
The title and paragraph text placed in the content slot, aligned alongside the media
Design Documentation
Live Demo
Anim excepteur aliqua excepteur ullamco ullamco voluptate laboris commodo nisi veniam aliquip ut.
<ba-media-object>
<ba-icon name="paper-plane" slot="media"></ba-icon>
<ba-content>
<p>Anim excepteur aliqua excepteur ullamco ullamco voluptate laboris commodo nisi veniam aliquip ut.</p>
</ba-content>
</ba-media-object>
Properties and attributes
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
alignMediaTo |
align-media-to |
Allows setting the media slot to match the height of the first line of text in the content slot. This is useful for aligning media with text in the content slot. |
"body" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "heading-micro-xs" | "heading-micro-xxs" | "heading-primary" | "heading-secondary" | "heading-tertiary" | "p" | "small-print" | "summary" | undefined |
undefined |
gutter |
gutter |
Set's the gutter between the media slot and the content | "16" | "24" | "32" | "40" | "48" | "8" | undefined |
'16' |
Permitted ARIA roles
- None
Slots
| Slot | Description | Permitted elements |
|---|---|---|
| Unnamed slot | Elements will render in the body of the component | <ba‑content>, <ba‑flex>, <ba‑grid> |
"media" |
Elements will render in the body of the component | <ba‑icon>, <ba‑image>, <ba‑logo>, <div>, <svg> |
Parent components
ba-media-object can be slotted into:
Usage
Using with ba-icon
<ba-media-object>
<ba-icon name="paper-plane" slot="media"></ba-icon>
<ba-content>
Anim excepteur aliqua excepteur ullamco ullamco voluptate laboris commodo nisi veniam aliquip ut.
</ba-content>
</ba-media-object>
Aligning ba-icon with first line of content
<ba-media-object align-media-to="h4">
<ba-icon name="paper-plane" slot="media" size="16"></ba-icon>
<ba-content>
<h4>Anim excepteur aliqua excepteur ullamco ullamco voluptate laboris commodo nisi veniam aliquip ut.</h4>
</ba-content>
</ba-media-object>
Using with ba-image
When using ba-media-object with ba-image a width must be set on the ba-image component using css, otherwise the image will not show. This prevents layout shifts when the browser loads the image.
<ba-media-object>
<ba-image
class="your-media-object-image-class"
slot="media"
alt="Description of image"
src="https://www.britishairways.com/assets/images/MediaHub/Media-Database/Royalty-free-RF/Destinations/USA/Florida/Orlando-MCO/524927017_1920x1080.jpg"
aspect-ratio="16-9"
></ba-image>
<ba-content>
Anim excepteur aliqua excepteur ullamco ullamco voluptate laboris commodo nisi veniam aliquip ut.
</ba-content>
</ba-media-object>
Guidelines
Keyboard navigation
State: ba-media-object is a non-interactive container
Focus moves through interactive elements within the media and content slots, skipping ba-media-object itself
Usage and accessibility checklist
Use this checklist to confirm the component has been configured and used correctly.
UX checklist
- ba-media-object is used to show some media (such as an icon or image) and content side by side
- When ba-image is used in the media slot, a width is explicitly set on it so it shows within ba-media-object
- The align-media-to attribute is used to align the media with a specific line of content, such as a heading, where needed
Accessibility checklist
- Media such as icons or images has appropriate alternative text, or is marked as decorative where it adds no information
- Heading levels used within the content slot follow a logical hierarchy and don't skip levels
These checks are handled by the component and do not need to be repeated each time it is used.
- ba-media-object is operable using assistive technology
- Has a visible focus indicator on all sides of the component
- Colour contrast for all states in all BAgel themes
- Animations respect users' reduced motion settings
- High contrast mode adjustments