Media component
Introduction
The Media component provides a flexible way to display images while ensuring proper loading states, fallbacks, and accessibility features. It handles lazy loading and includes built-in error handling.
When to use
- Responsive images
- Blog post media
- Product images
- Background media
- Any content requiring image display
- Hero sections
- Gallery items
Usage
Props
Prop | Type | Default | Description |
---|---|---|---|
src | string | required | URL or path to the image |
alt | string | '' | Alternative text for the image (required for accessibility) |
class | string | '' | Additional CSS classes to apply |
Accessibility features
- Required
alt
text support for images - Loading states with appropriate ARIA attributes
- High contrast fallback for loading states
- Error states for failed image loads
- Proper focus management