Featured Product List
Installation
Add the following Soul components
The featured-product-list component uses the streamable, button-link, product-card, product-list and sticky-sidebar-layout components. Make sure you have added them to your project.
Copy and paste the following code into your project
sections/featured-product-list/index.tsx
import { Streamable } from '@/vibes/soul/lib/streamable';import { ButtonLink } from '@/vibes/soul/primitives/button-link';import { type Product } from '@/vibes/soul/primitives/product-card';import { ProductList } from '@/vibes/soul/sections/product-list';import { StickySidebarLayout } from '@/vibes/soul/sections/sticky-sidebar-layout';interface Link { label: string; href: string;}export interface FeaturedProductsListProps { title: string; description?: string; cta?: Link; products: Streamable<Product[]>; emptyStateTitle?: Streamable<string>; emptyStateSubtitle?: Streamable<string>; placeholderCount?: number;}/** * This component supports various CSS variables for theming. Here's a comprehensive list, along * with their default values: * * ```css * :root { * --featured-product-list-font-family: var(--font-family-body); * --featured-product-list-title-font-family: var(--font-family-heading); * --featured-product-list-title: hsl(var(--foreground)); * --featured-product-list-description: hsl(var(--contrast-500)); * } * ``` */export function FeaturedProductList({ title, description, cta, products, emptyStateTitle, emptyStateSubtitle, placeholderCount,}: FeaturedProductsListProps) { return ( <StickySidebarLayout sidebar={ <header className="font-[family-name:var(--featured-product-list-font-family,var(--font-family-body))]"> <h2 className="mb-3 font-[family-name:var(--featured-product-list-title-font-family,var(--font-family-heading))] text-4xl font-medium leading-none text-[var(--featured-product-list-title,hsl(var(--foreground)))] @4xl:text-5xl"> {title} </h2> {description != null && description !== '' && ( <p className="mb-8 max-w-xl text-lg leading-normal text-[var(--featured-product-list-description,hsl(var(--contrast-500)))]"> {description} </p> )} {cta?.href != null && cta.href !== '' && cta.label !== '' && ( <ButtonLink href={cta.href} variant="secondary"> {cta.label} </ButtonLink> )} </header> } sidebarSize="1/3" > <div className="group/product-list flex-1"> <ProductList emptyStateSubtitle={emptyStateSubtitle} emptyStateTitle={emptyStateTitle} placeholderCount={placeholderCount} products={products} showCompare={false} /> </div> </StickySidebarLayout> );}
Usage
import { FeaturedProductList } from '@/vibes/soul/sections/featured-product-list';function Usage() { return ( <FeaturedProductList cta={{ label: 'Shop Now', href: '#', }} description="Lorem ipsum dolor sit amet, consectetur adipiscing elit duat pronto." products={products} title="Our gear" /> );}const products = [ { id: '1', title: 'Mini Bar Bag', subtitle: 'Blue/Black/Green', price: '$65', image: { src: 'https://rstr.in/monogram/vibes/mrlTNE1TJfB', alt: 'Mini Bar Bag', }, href: '#', rating: 4.3, },]
API Reference
FeaturedProductList
Prop | Type | Default |
---|---|---|
className | string | |
title* | string | |
description | string | |
cta | Link | |
products* | ||
emptyStateTitle | Streamable <string> | |
emptyStateSubtitle | Streamable <string> | |
placeholderCount | number |
Product
Prop | Type | Default |
---|---|---|
id* | string | |
title* | string | |
href* | string | |
image | { src: string; alt: string } | |
price | Price | |
subtitle | string | |
badge | string | |
rating | number |
Link
Prop | Type | Default |
---|---|---|
label* | string | |
href* | string |
CSS Variables
This component supports various CSS variables for theming. Here's a comprehensive list.
:root { --featured-product-list-font-family: var(--font-family-body); --featured-product-list-title-font-family: var(--font-family-heading); --featured-product-list-title: hsl(var(--foreground)); --featured-product-list-description: hsl(var(--contrast-500));}