Using Images
The Img component displays optimized images with automatic responsive sizing and an optional click-to-enlarge modal. Images must be local files in src/assets/.
Place images in the matching asset folder for your post type:
| Post type | Image folder |
|---|---|
| Events | src/assets/events/ |
| Projects | src/assets/projects/ |
Then import the image using the @assets alias:
import { Accordion, Button, Callout, Carousel, Center, ImageGrid, Img, Instagram, Marquee, YouTube, SideBySide, Left, Right } from '@mdx';
import photo from '@assets/events/my-photo.jpg';
<Img src={photo} alt="Workshop participants" />


Click the image above to see the full-size modal.
Controlling Width
Set width to any CSS value — percentages, pixels, etc:
<Img src={photo} alt="Small preview" width="50%" />


Disabling Click-to-Enlarge
For decorative images or icons where the modal doesn’t make sense:
<Img src={photo} alt="Decorative" enableClickToEnlarge={false} />
Required Fields
| Field | Type | Description |
|---|---|---|
src | ImageMetadata | Imported image file (e.g., import img from '@assets/...') |
alt | string | Description for accessibility |
Optional Fields
| Field | Type | Description |
|---|---|---|
width | string | CSS width, e.g. "50%", "400px" (default: "100%") |
enableClickToEnlarge | boolean | Show full-size modal on click (default: true) |
loading | enum | "lazy" or "eager" — use eager for above-the-fold (default: "lazy") |
fill | boolean | Stretch to fill parent container (default: false) |
class | string | Extra CSS classes, e.g. "rounded-full shadow-lg" |