Image & Hero Component Demo

Drop-in components with focal points, captions, responsive srcset, and automatic optimization.

Hero Component (Split Layout)

Split-layout hero with image on one side and content panel on the other. Like the original HeroTitle component.

Image Left (50%), Content Right

Hero image

Welcome to Hawaii

Your trusted source for real estate resources.

Learn More

Image Right (60%), Content Left

Hero image

Professional Development

Advance your career with our courses

Narrow Image (40%), Top Aligned Content

Hero image

About Us

Learn about our mission and values

<Hero 
    src="/images/hero.jpg"
    height="400"
    focalY=30
    imageWidth="50%"
    imagePosition="left"
    contentBg="#1a365d"
    contentY="middle"
    contentPadding="3rem"
>
    <h2>Your Title</h2>
    <p>Your content here</p>
</Hero>

Responsive Width (srcset)

Use displayWidth with percentage values. The browser downloads the optimal image size from the generated srcset.

50% width with srcset

About Us
<Image 
    src="/images/photo.jpg" 
    alt="Photo"
    displayWidth="50%"
    maxWidth=1200
/>

100% width (full container)

About Us
<Image 
    src="/images/photo.jpg" 
    alt="Photo"
    displayWidth="100%"
/>

Fixed Dimensions with Focal Point

Use both displayWidth and displayHeight for cropping with focal point control.

300px × 150px, focal bottom

About Us

300px × 150px, focal top

About Us
<Image 
    src="/images/photo.jpg" 
    alt="Photo"
    displayWidth="300px"
    displayHeight="150px"
    focalY=100
    fit="cover"
/>

Aspect Ratio Cropping

Use aspectRatio to maintain consistent proportions across all srcset sizes.

16:9 aspect ratio

Advocacy

1:1 (square)

Advocacy
<Image 
    src="/images/photo.jpg" 
    alt="Photo"
    displayWidth="100%"
    aspectRatio="16/9"
/>

Focal Points

Control where the image focuses when cropped. Values are 0-100 for X and Y. Requires both displayWidth AND displayHeight.

Top Left (focalX=0, focalY=0)

Focal top-left

Center (default: focalX=50, focalY=50)

Focal center

Bottom Right (focalX=100, focalY=100)

Focal bottom-right
<Image 
    src="/images/photo.jpg" 
    alt="Photo"
    displayWidth="300px"
    displayHeight="150px"
    focalX=0
    focalY=0
    fit="cover"
/>

Captions

Overlay Caption (default)

Professional Development
Professional Development opportunities for REALTORS®
<Image 
    src="/images/photo.jpg" 
    alt="Photo"
    displayWidth="400"
    caption="Your caption here"
    captionPosition="overlay"
/>

Caption Below

News and Resources
Figure 1: News and Resources section
<Image 
    src="/images/photo.jpg" 
    alt="Photo"
    displayWidth="400"
    caption="Figure 1: Description"
    captionPosition="below"
    captionBg="#f0f0f0"
    captionColor="#333"
/>

Custom Caption Styling

Red Theme

About Us
Important Notice

Blue Theme

About Us
Featured Content

Light Theme (Below)

About Us
Photo credit: Hawaii REALTORS®

Object Fit Options

Different ways the image can fit within the specified dimensions.

cover (default)

Cover

Fills the box, cropping as needed

contain

Contain

Fits entirely within the box

fill

Fill

Stretches to fill (may distort)

All Props Reference

Prop Type Default Description
src string required Image URL or path
alt string required Alt text for accessibility
displayWidth string | number - CSS width (e.g., "50%", "300px", or 300)
displayHeight string | number - CSS height (e.g., "200px" or 200). Required for focal point.
maxWidth number 1600 Max width for srcset generation (px)
aspectRatio string - Aspect ratio for cropping (e.g., "16/9")
sizes string auto Responsive sizes hint (e.g., "(max-width: 768px) 100vw, 50vw")
focalX number 50 Focal point X position (0-100)
focalY number 50 Focal point Y position (0-100)
caption string - Caption text
captionPosition "overlay" | "below" "overlay" Where to display the caption
captionBg string rgba(0,0,0,0.7) Caption background color
captionColor string #ffffff Caption text color
fit string "cover" CSS object-fit value
quality number 80 Image quality (1-100)
loading "lazy" | "eager" "lazy" Loading strategy
class string - Additional CSS classes