# Product Carousel Hero

> A hero with a swipeable product carousel beside a headline and CTA. Showcases a range of items or plans at the top of an ecommerce landing page.

A shadcn/ui block from the [@shadcn-ui-blocks](https://www.shadcn-ui-blocks.com) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/shadcn-ui-blocks/marketing-hero-sections-product-carousel-hero).

- Page, with a live preview: https://shadcn.exchange/r/shadcn-ui-blocks/marketing-hero-sections-product-carousel-hero
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/shadcn-ui-blocks/marketing-hero-sections-product-carousel-hero-light-05c4c3af09b26640.png
- Registry item: https://www.shadcn-ui-blocks.com/r/marketing-hero-sections-product-carousel-hero.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://www.shadcn-ui-blocks.com/r/marketing-hero-sections-product-carousel-hero.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `class-variance-authority`, `lucide-react`, `radix-ui`

## Files

### `components/blocks/marketing/hero-sections/product-carousel-hero.tsx`

```tsx
import { useState } from 'react';

import { Button } from '@/components/ui/button';
import { ArrowLeft, ArrowRight, Check } from 'lucide-react';

export default function ProductCarouselHero() {
  const [activeIndex, setActiveIndex] = useState(0);

  const products = [
    {
      name: 'Premium Dashboard',
      description:
        'Analytics dashboard with advanced filtering and data visualization',
      image:
        'https://images.unsplash.com/photo-1551288049-bebda4e38f71?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.0.3',
      color: '#4f46e5',
    },
    {
      name: 'Mobile App',
      description:
        'Cross-platform mobile application with offline capabilities',
      image:
        'https://images.unsplash.com/photo-1551650975-87deedd944c3?q=80&w=2074&auto=format&fit=crop&ixlib=rb-4.0.3',
      color: '#0ea5e9',
    },
    {
      name: 'Design System',
      description: 'Comprehensive UI library with 100+ components and variants',
      image:
        'https://images.unsplash.com/photo-1545235617-9465d2a55698?q=80&w=2080&auto=format&fit=crop&ixlib=rb-4.0.3',
      color: '#f59e0b',
    },
  ];

  const nextSlide = () => {
    setActiveIndex((prevIndex) => (prevIndex + 1) % products.length);
  };

  const prevSlide = () => {
    setActiveIndex(
      (prevIndex) => (prevIndex - 1 + products.length) % products.length
    );
  };

  return (
    <div className="from-background to-muted/30 relative bg-gradient-to-b">
      <div className="container mx-auto px-4 pt-24 pb-20 md:px-6 md:pt-32 md:pb-24 2xl:max-w-[1400px]">
        <div className="grid items-center gap-12 md:grid-cols-2 md:gap-16">
          <div className="flex flex-col justify-center space-y-4">
            <div className="space-y-2">
              <p className="text-primary text-sm font-medium tracking-widest uppercase">
                Introducing
              </p>
              <h1 className="text-3xl font-bold tracking-tight sm:text-4xl md:text-5xl lg:text-6xl">
                Build beautiful products, faster.
              </h1>
              <p className="text-muted-foreground max-w-[600px] md:text-xl">
                Our comprehensive suite of tools helps teams design, develop,
                and deploy exceptional digital experiences.
              </p>
            </div>

            <ul className="space-y-2 pt-4">
              <li className="flex items-center gap-2">
                <Check className="text-primary h-5 w-5" />
                <span>Pre-built components save development time</span>
              </li>
              <li className="flex items-center gap-2">
                <Check className="text-primary h-5 w-5" />
                <span>Intuitive drag-and-drop interface</span>
              </li>
              <li className="flex items-center gap-2">
                <Check className="text-primary h-5 w-5" />
                <span>Regular updates and dedicated support</span>
              </li>
            </ul>

            <div className="flex flex-col gap-3 pt-4 sm:flex-row">
              <Button size="lg" asChild>
                <a href="#">Start Free Trial</a>
              </Button>
              <Button size="lg" variant="outline" asChild>
                <a href="#">View Demo</a>
              </Button>
            </div>

            <div className="pt-6">
              <p className="text-muted-foreground mb-2 text-sm">
                Trusted by leading companies:
              </p>
              <div className="flex flex-wrap items-center gap-6">
                {['Microsoft', 'Airbnb', 'Spotify', 'Uber'].map(
                  (company, i) => (
                    <div
                      key={i}
                      className="text-muted-foreground/70 font-medium"
                    >
                      {company}
                    </div>
                  )
                )}
              </div>
            </div>
          </div>

          <div className="relative">
            {/* Product showcase */}
            <div className="relative aspect-[4/3] overflow-hidden rounded-xl border shadow-xl">
              <div
                className="absolute inset-0 transition-opacity duration-500"
                style={{
                  opacity: activeIndex === 0 ? 1 : 0,
                  zIndex: activeIndex === 0 ? 10 : 0,
                }}
              >
                <img
                  src={products[0]!.image}
                  alt={products[0]!.name}
                  className="object-cover"
                />
                <div className="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"></div>
                <div className="absolute right-0 bottom-0 left-0 p-6">
                  <h3 className="mb-1 text-xl font-bold text-white">
                    {products[0]!.name}
                  </h3>
                  <p className="text-sm text-white/80">
                    {products[0]!.description}
                  </p>
                </div>
              </div>

              <div
                className="absolute inset-0 transition-opacity duration-500"
                style={{
                  opacity: activeIndex === 1 ? 1 : 0,
                  zIndex: activeIndex === 1 ? 10 : 0,
                }}
              >
                <img
                  src={products[1]!.image}
                  alt={products[1]!.name}
                  className="object-cover"
                />
                <div className="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"></div>
                <div className="absolute right-0 bottom-0 left-0 p-6">
                  <h3 className="mb-1 text-xl font-bold text-white">
                    {products[1]!.name}
                  </h3>
                  <p className="text-sm text-white/80">
                    {products[1]!.description}
                  </p>
                </div>
              </div>

              <div
                className="absolute inset-0 transition-opacity duration-500"
                style={{
                  opacity: activeIndex === 2 ? 1 : 0,
                  zIndex: activeIndex === 2 ? 10 : 0,
                }}
              >
                <img
                  src={products[2]!.image}
                  alt={products[2]!.name}
                  className="object-cover"
                />
                <div className="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"></div>
                <div className="absolute right-0 bottom-0 left-0 p-6">
                  <h3 className="mb-1 text-xl font-bold text-white">
                    {products[2]!.name}
                  </h3>
                  <p className="text-sm text-white/80">
                    {products[2]!.description}
                  </p>
                </div>
              </div>
            </div>

            {/* Carousel controls */}
            <div className="absolute right-0 -bottom-10 flex gap-2">
              <Button
                variant="outline"
                size="icon"
                onClick={prevSlide}
                className="h-10 w-10 rounded-full"
              >
                <ArrowLeft className="h-4 w-4" />
                <span className="sr-only">Previous</span>
              </Button>
              <Button
                variant="outline"
                size="icon"
                onClick={nextSlide}
                className="h-10 w-10 rounded-full"
              >
                <ArrowRight className="h-4 w-4" />
                <span className="sr-only">Next</span>
              </Button>
            </div>

            {/* Product indicators */}
            <div className="absolute -bottom-10 left-0 flex items-center gap-2">
              {products.map((product, index) => (
                <button
                  key={index}
                  onClick={() => setActiveIndex(index)}
                  className={`h-2.5 rounded-full transition-all ${
                    activeIndex === index ? 'w-8' : 'w-2.5 opacity-50'
                  }`}
                  style={{ backgroundColor: product.color }}
                  aria-label={`View ${product.name}`}
                />
              ))}
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}
```

### `components/ui/button.tsx`

```tsx
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { Slot } from "radix-ui"

import { cn } from "@/lib/utils"

const buttonVariants = cva(
  "group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
  {
    variants: {
      variant: {
        default: "bg-primary text-primary-foreground hover:bg-primary/80",
        outline:
          "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
        secondary:
          "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
        ghost:
          "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
        destructive:
          "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
        link: "text-primary underline-offset-4 hover:underline",
      },
      size: {
        default:
          "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
        xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
        sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
        lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
        icon: "size-9",
        "icon-xs":
          "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
        "icon-sm":
          "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
        "icon-lg": "size-10",
      },
    },
    defaultVariants: {
      variant: "default",
      size: "default",
    },
  }
)

function Button({
  className,
  variant = "default",
  size = "default",
  asChild = false,
  ...props
}: React.ComponentProps<"button"> &
  VariantProps<typeof buttonVariants> & {
    asChild?: boolean
  }) {
  const Comp = asChild ? Slot.Root : "button"

  return (
    <Comp
      data-slot="button"
      data-variant={variant}
      data-size={size}
      className={cn(buttonVariants({ variant, size, className }))}
      {...props}
    />
  )
}

export { Button, buttonVariants }
```
