Staaarter

Alternating Image & Content

A zig-zag feature layout where each row alternates a full-bleed image with a content block: a colored icon badge, a bold title, and a description. The image swaps sides on every other row.

By Staaarter Team
Feature
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its media-slot dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/alternating-image-and-content.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/feature/feature164.tsx instead.

Usage

The file also exports feature164Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Feature164, feature164Demo } from "@/components/blocks/feature/feature164";

export default function Page() {
  return <Feature164 {...feature164Demo} />;
}

Props

PropTypeDefaultDescription
eyebrowstringnoneSmall label above the heading.
headingReactNodenoneSection heading.
descriptionstringnoneSupporting copy under the heading.
rowsAlternatingRow[]noneImage/content rows, alternating sides in array order.
classNamestringnoneExtra classes for the outer section element.

Types

type Feature164Accent =
  | "emerald" | "primary" | "foreground" | "rose" | "blue"
  | "amber" | "violet" | "sky" | "orange" | "teal";

type AlternatingRow = {
  icon: LucideIcon;
  accent: Feature164Accent;
  title: string;
  description: string;
  image: { src: string; alt: string };
};

Behavior notes

  • Fully static server component, no client-side state.
  • Every other row (index 1, 3, 5...) flips order on `sm` and up via `sm:[&>*:first-child]:order-2`; both columns stack image-above-content on mobile.
  • The icon badge's accent color comes from a closed union mapped through a fixed lookup object (ACCENT_CLASSES) to real Tailwind classes, never an arbitrary literal color string passed through as a className.