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

Top3

Showcase top three items in a three-column layout

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

Use the Top3 component to showcase top three items in a visually appealing three-column layout. Each item can include an image, title, rating, description, and a call-to-action (CTA) button. They:

Best Value
Modern apartment in downtown area
Modern Downtown Apartment ★★★★★ 4.8/5 A stylish 2-bedroom apartment located in the heart of downtown, close to public transport and shopping.
Most Popular
Spacious family house with garden
Spacious Family House ★★★★★ 4.7/5 A comfortable 4-bedroom house with a private garden, perfect for families looking for space and quiet.
Cheapest option
Cozy studio apartment
Cozy Studio Apartment ★★★★★ 4.6/5 An affordable and cozy studio apartment ideal for students or young professionals with a beautiful garden.
Unlock code
How to use the Top3 component in Astro
---
const items = [
{
ribbon: {
label: 'Best Value'
},
img: {
src: '/img/properties/property1.png',
alt: 'Modern apartment in downtown area',
width: 600,
height: 250
},
title: 'Modern Downtown Apartment',
rating: {
score: 4.8,
color: 'var(--w-color-warning)',
showText: true,
text: '{0}/{1}'
},
description: 'A stylish 2-bedroom apartment...',
cta: {
text: 'View Details ->'
}
},
{ ... },
{ ... }
]
---
<Top3 items={items} />

The Top3 component expects an array of items via the items prop. Each item can include various optional properties to customize its appearance and functionality. Only the img and title props are required, all other props are optional.

Top3 with required props only
Modern apartment in downtown area
Modern Downtown Apartment
Spacious family house with garden
Spacious Family House
Cozy studio apartment
Cozy Studio Apartment
Unlock code
Using Top3 with required props only
---
const items = [
{
img: {
src: '/img/properties/property1.png',
alt: 'Modern apartment in downtown area',
width: 600,
height: 250
},
title: 'Modern Downtown Apartment'
},
{ ... },
{ ... }
]
---
<Top3 items={items} />

Ratings

The ratings on each item can be configured using the rating prop, which accepts an object in the form of RatingProps. This allows you to display star ratings along with optional text, such as number of ratings:

Modern apartment in downtown area
Modern Downtown Apartment ★★★★★ 4.8/5 10 reviews
Spacious family house with garden
Spacious Family House ★★★★★ 4.7/5 11 reviews
Cozy studio apartment
Cozy Studio Apartment ★★★★★ 4.6/5 12 reviews
Unlock code
How to customize ratings
---
const items = [
{
...,
rating: {
score: 4.8,
color: 'var(--w-color-info)',
showText: true,
size: 16,
reviewCount: 10,
text: '{0}/{1}'
}
},
{ ... },
{ ... }
]
---
<Top3 items={items} />

Ribbons

Optionally, you can add a ribbon to each item using the ribbon prop. This prop accepts an object with properties to customize the ribbon’s appearance and text:

Modern apartment in downtown area
Modern Downtown Apartment ★★★★★ 4.8/5 A stylish 2-bedroom apartment located in the heart of downtown, close to public transport and shopping.
Featured
Spacious family house with garden
Spacious Family House ★★★★★ 4.7/5 A comfortable 4-bedroom house with a private garden, perfect for families looking for space and quiet.
Cozy studio apartment
Cozy Studio Apartment ★★★★★ 4.6/5 An affordable and cozy studio apartment ideal for students or young professionals with a beautiful garden.
Unlock code
How to use ribbons
---
const items = [
{
...,
ribbon: { label: 'Featured' }
},
{ ... },
{ ... }
]
---
<Top3 items={items} />

Ribbons have a default color scheme, which you can either override on a per-ribbon basis using the colorText, colorStart, and colorEnd properties or globally using the following CSS variables:

Unlock code
How to customize ribbon colors with CSS
html body {
--w-top3-ribbon-color: #FFF;
--w-top3-ribbon-bg-start: #1CAED7;
--w-top3-ribbon-bg-end: #4E00C2;
}

Secondary Cards

Items are displayed using Card components. You can switch to the secondary style by setting the secondary prop to true for one, or all items:

Best Value
Modern apartment in downtown area
Modern Downtown Apartment ★★★★★ 4.8/5 A stylish 2-bedroom apartment located in the heart of downtown, close to public transport and shopping.
Most Popular
Spacious family house with garden
Spacious Family House ★★★★★ 4.7/5 A comfortable 4-bedroom house with a private garden, perfect for families looking for space and quiet.
Cheapest option
Cozy studio apartment
Cozy Studio Apartment ★★★★★ 4.6/5 An affordable and cozy studio apartment ideal for students or young professionals with a beautiful garden.
Unlock code
How to use secondary cards
---
const items = [
{
...,
secondary: true
},
{ ... },
{ ... }
]
---
<Top3 items={items} />

CTA Buttons

Each item can include a call-to-action (CTA) button configured via the cta prop. This prop accepts an object in the form of ButtonProps, allowing you to customize the button’s text, icon, and other properties:

Best Value
Modern apartment in downtown area
Modern Downtown Apartment ★★★★★ 4.8/5 A stylish 2-bedroom apartment located in the heart of downtown, close to public transport and shopping.
Most Popular
Spacious family house with garden
Spacious Family House ★★★★★ 4.7/5 A comfortable 4-bedroom house with a private garden, perfect for families looking for space and quiet.
Cheapest option
Cozy studio apartment
Cozy Studio Apartment ★★★★★ 4.6/5 An affordable and cozy studio apartment ideal for students or young professionals with a beautiful garden.
Unlock code
How to add CTA buttons
---
const items = [
{
...,
cta: {
text: 'Learn More',
theme: 'secondary',
icon: 'info'
}
},
{ ... },
{ ... }
]
---
<Top3 items={items} />

API

Unlock code
Component API reference
type Top3Props = {
items: {
ribbon?: {
colorText?: string
colorStart?: string
colorEnd?: string
label: string
},
img: {
src: string
alt: string
width: number
height: number
lazy?: boolean
}
title: string
rating?: RatingProps
description?: string
secondary?: boolean
cta?: ({
text: string
icon?: string
} & ButtonProps)
}[]
className?: string
}
PropPurpose
items Sets an array of items to display.
items.ribbon Optional ribbon configuration for each item, including text and colors.
items.ribbon.colorText Sets the text color of the ribbon.
items.ribbon.colorStart Sets the starting background color of the ribbon gradient.
items.ribbon.colorEnd Sets the ending background color of the ribbon gradient.
items.ribbon.label Sets the text label on the ribbon.
items.img.src Sets the source URL of the image.
items.img.alt Sets the alt text for the image.
items.img.width Sets the width of the image.
items.img.height Sets the height of the image.
items.img.lazy Set to true to enable image lazy loading.
items.title Sets the title of the item.
items.rating Optional rating configuration for the item using RatingProps.
items.description Sets an optional description for the item.
items.secondary Set to true to apply secondary styling to the item's card.
items.cta Optional CTA button configuration using ButtonProps.
items.cta.text Sets the text displayed on the CTA.
items.cta.icon Sets an optional icon to display on the CTA.
className Pass additional CSS classes for the component.