Segmented State Compare

(Switch it)

The old bag and the one that replaced it.

Unbranded paper packaging in soft daylightMinimal coffee packaging arranged on a concrete surface

One colour, one voice and the origin on the front

Uncoated stock, a single ink and the name doing the work. Cheaper to print and easier to find on a busy shelf.

  • Single-colour print run
  • Origin and roast date on the face
  • Shelf recognition under two seconds: yes
About this block

Segmented State ComparePRO

Two versions of the same object compared through a segmented pill control: the photographs cross-fade in place while the title, explanation and ruled note list swap beside them.

Reveal7: Segmented State Compare

Two states of the same thing, switched with a segmented control in the header. The photograph cross-fades while the statement, paragraph and ruled notes beside it swap to match.

Upgrade to Pro

Pro blocks install through the shadcn CLI with your license key and ship their full source. Docs and live previews stay open to everyone, so you can read every block's details first.

Upgrade Now

Installation

Swap YOUR_EMAIL and YOUR_KEY for the email and license key on your account. Find your license key on your account page.

Radix flavor

bash
npx shadcn add "https://ui.beste.co/r/reveal7?email=YOUR_EMAIL&license_key=YOUR_KEY"

Base UI flavor

bash
npx shadcn add "https://ui.beste.co/r-base/reveal7?email=YOUR_EMAIL&license_key=YOUR_KEY"

This installs the block to components/beste/block/reveal7.tsx plus the badge7 eyebrow it uses.

Quick start

The installed file exports reveal7Demo alongside the block: the exact props behind the preview above. Spread it to get a working comparison in one line.

tsx
import { Reveal7, reveal7Demo } from "@/components/beste/block/reveal7";

export default function Page() {
  return <Reveal7 {...reveal7Demo} />;
}

Then replace the demo with your own props. Written out, a trimmed setup looks like this:

tsx
import { Reveal7 } from "@/components/beste/block/reveal7";

export default function Page() {
  return (
    <Reveal7
      badge={{ label: "Switch it" }}
      heading="The old bag and the one that replaced it."
      states={[
        {
          label: "2019 packaging",
          title: "Illustrated, crowded, unreadable at arm's length",
          description: "Six colours, a hand-drawn scene and four typefaces.",
          src: "/packaging/old.jpg",
          alt: "Unbranded paper packaging",
          notes: ["Six-colour print run", "Origin buried on the reverse"],
        },
        {
          label: "Current packaging",
          title: "One colour, one voice and the origin on the front",
          description: "Uncoated stock, a single ink and the name doing the work.",
          src: "/packaging/new.jpg",
          alt: "Minimal coffee packaging",
          notes: ["Single-colour print run", "Origin and roast date on the face"],
        },
      ]}
    />
  );
}

Props

PropTypeDefaultDescription
badge{ label: string }Eyebrow label rendered as a Badge7
headingstringSection heading in the header row
statesCompareState[][]The states being compared, one segment each
classNamestringExtra classes for the outer <section>
ts
type CompareState = {
  label: string;
  title: string;
  description: string;
  src: string;
  alt: string;
  notes: string[];
};

Behavior notes

  • The block opens on the last state when more than one is passed (useState(states.length > 1 ? 1 : 0)), so a visitor sees the current version first and switches back to the old one deliberately.
  • Every image is rendered at once and cross-faded with transition-opacity duration-500, so switching never shows an empty frame while a file downloads.
  • The segmented control is a real set of button elements with aria-pressed, sitting in a bg-muted track with the selected pill on bg-background, so the state is exposed as well as drawn.
  • Notes are a plain ul with a border-t rule per row, which lets the two lists line up against each other when you flip between the states.
  • The control lives in the header on the heading's baseline (items-end), so switching does not require scrolling past the picture.
  • The frame changes ratio rather than height (aspect-[4/3] becoming md:aspect-[3/2]), so both states are cropped identically at every width and the comparison stays honest.
  • Copy is capped at max-w-md in the side column, so the two states' text blocks occupy the same measure and differences in length read as content rather than layout.

More Reveal blocks

View all Reveal
PRO

reveal6

Drag Compare Slider

Before and after comparison where a pointer-driven handle clips the earlier photograph over the later one, with pill labels on both corners and a ruled row of outcome figures beneath.

PRO

reveal13

Hold To Compare

Press-and-hold comparison: holding the frame or the button cross-fades the earlier photograph in and swaps the corner label and caption, releasing returns to the current one.

PRO

reveal12

Tile Flip Compare

Two photographs split across the same grid so each square can be flipped from before to after on click, with buttons to turn the whole frame over and a counter of how much has been revealed.

PRO

reveal8

Vertical Split Compare

Comparison that splits horizontally instead of down the middle: a draggable divider wipes the upper photograph away to expose the lower one, with pill labels and a caption for each state.

PRO

reveal10

Self Sweeping Compare

Before and after comparison that plays itself: the seam walks from edge to edge on a timer, clicking the picture freezes it at that point, and a single round control resumes or holds the sweep between the two captions.

PRO

reveal9

Spotlight Lens Compare

Before and after comparison seen through a draggable circular lens: the earlier photograph fills the frame while the later one shows only inside the circle, which follows the pointer or the arrow keys.