🚀 Ship faster with premium components 🚀
Search documentation v1.3.0

Hero with Carousel

Present key information to users supported by a carousel

Source Report Issue
Command docs
How to add this block to your project
npm run add Hero

Use the Hero component to display a hero section with a carousel of images and list items. They’re space efficient and can be used to highlight key information to your users.

Preview
New Hero components

Ship Faster

Production-ready, beautifully crafted components

AvatarAvatarAvatarAvatarAvatar
★★★★★ 123 devs already building faster
Unlock code
How to add a carousel to the Hero component
---
const heroProps = { ... } // See the Hero documentation for more info
const carousel = {
items: 3,
pagination: {
type: 'dots'
}
}
---
<Hero {...heroProps} carousel={carousel}>
<li>
<img
src="/img/hero-slide1.png"
alt="Hero slide"
width="500"
height="250"
/>
</li>
<li>...</li>
<li>...</li>
</Hero>
This component is based off the free Hero component. You can read more about how it works in the Hero component documentation.

To define a carousel, you can use the carousel prop that accepts an object in the form of CarouselProps. Make sure you pass carousel.items to configure the number of slides in the carousel. You can set the slides by passing them as children to the Hero component.

If the Hero component defines both a carousel and image prop, the carousel prop will take precedence.

If you need to configure the carousel, you can pass those props to the carousel object. For example, you can use the subText prop to display a label under the slides. Use the {0} and {1} placeholders to display the current slide and total number of slides.

Hero with dynamic carousel label
New Hero components

Ship Faster

Production-ready, beautifully crafted components

AvatarAvatarAvatarAvatarAvatar
★★★★★ 123 devs already building faster
Unlock code
Hero carousel with dynamic text
---
const heroProps = { ... }
const carousel = {
items: 3,
subText: 'Slide {0} of {1}',
}
---
<Hero {...heroProps} reverse={true} carousel={carousel}>
...
</Hero>
For more information on how to configure the carousel, see the Carousel component API documentation.

Lists

You can also pass an icon list using the list prop that accepts an object in the form of IconListProps. The list will be rendered at the bottom of the hero section, and can be used to highlight key information to your users.

Hero with carousel and list
New Hero components

Ship Faster

Production-ready, beautifully crafted components

AvatarAvatarAvatarAvatarAvatar
★★★★★ 123 devs already building faster
  • Easy to integrate
  • Responsive and mobile-ready
  • Customizable themes
Unlock code
How to display an icon list
---
const heroProps = { ... }
const list = {
color: 'var(--w-color-info)',
items: [
{
icon: 'circle-check',
text: 'Easy to integrate'
},
{
icon: 'circle-check',
text: 'Responsive and mobile-ready'
},
{
icon: 'circle-check',
text: 'Customizable themes'
}
]
}
---
<Hero {...heroProps} list={list}>
<li>...</li>
<li>...</li>
<li>...</li>
</Hero>

API

Unlock code
Component API reference
type Props = {
carousel?: CarouselProps
list?: IconListProps
} & HeroProps
PropPurpose
carousel Sets a carousel. Pass an object using the props of a Carousel component.
list Sets an icon list. Pass an object using the props of an IconList component.