Skip to content

Index List

A list of names where pointing at one chooses it, the rest step back and its panel shows beside the list.

$npx shadcn@latest add https://framebrick.co/r/index-list.json

From the Tustel template, see it in context.

  • Positioning, audience research and a voice your team can actually keep to.

    Glass-walled office corridor with a sofa and a floor lamp

Examples

Cross-fade

The panels stay in place and the chosen one fades in over the others.

  • Positioning, audience research and a voice your team can actually keep to.

    Glass-walled office corridor with a sofa and a floor lamp
<IndexList label="Team" swap="fade" items={…} />

Rise

The new panel replays an appear: it fades in from 18 px lower and overshoots a touch.

  • Positioning, audience research and a voice your team can actually keep to.

    Glass-walled office corridor with a sofa and a floor lamp
<IndexList label="Services" swap="rise" trigger="click" items={…} />

Team tabs

Tabs of people with an avatar, a name and a role, beside the profile of the chosen one, which fades in; narrow, it opens under its name.

  • Portrait of a woman in a red topFillings, check-ups and the long conversation about what to do first.
<IndexList
  label="Our team"
  trigger="click"
  swap="fade"
  dimmed={0.7}
  nameClassName="w-full rounded-lg border p-3 text-base"
  items={doctors.map((d) => ({
    value: d.slug,
    title: <span className="flex items-center gap-3"><img src={d.photo} alt="" className="size-12 rounded-full" /><span>{d.name}<br />{d.role}</span></span>,
    panel: <DoctorCard doctor={d} />,
  }))}
/>

Sticky team list

A long list scrolls past a photo that stays put.

  • Portrait of a woman in a red top
// sticky={83} holds the photo 83 px under a fixed header while the page scrolls
<IndexList label="Team" swap="fade" sticky={83} items={…} />

Installation

$ npx shadcn@latest add https://framebrick.co/r/index-list.json

Usage

import { IndexList } from "@/components/ui/index-list";

<IndexList
  label="Services"
  nameClassName="aria-expanded:text-orange-600"   // colour the chosen name through its aria-expanded state
  items={services.map((s, i) => ({
    value: s.slug,
    marker: String(i + 1).padStart(2, "0"),
    title: s.name,
    panel: (
      <>
        <p>{s.summary}</p>
        <Image src={s.photo} alt="" width={300} height={200} />
      </>
    ),
  }))}
/>

Props

PropTypeDefaultDescription
items{ value, title, marker?, panel }[]—The names. `panel` is what shows while the name is chosen: beside the list when it is wide enough, under the name when it is not.
labelstring—Accessible name of the list.
valuestring—Chosen name (controlled).
defaultValuestringfirst itemName that starts chosen (uncontrolled).
onValueChange(value: string) => void—Called when another name is chosen.
trigger"hover" | "click""hover"Whether pointing at a name with a mouse chooses it, while the panel is beside the list. A click or Enter always does.
dimmednumber0.65Opacity of the names that are not chosen.
swap"cut" | "fade" | "rise""cut"What happens to the panel beside the list. "cut" changes it at once (Tustel); "fade" cross-fades it over the others (Cerette team); "rise" replays an appear on the new one, opacity 0 to 1 and 18 px up over 1 s (Cerette services). The narrow layout always opens by height.
stickynumber—Px from the top at which the panel beside the list sticks while the list scrolls past it (Cerette: 83, under its header). CSS only; an ancestor with overflow hidden or auto breaks it.
panelWidthnumber360Width of the panel when it is beside the list, in px — never more than 55% of the list.
nameClassNamestring—Classes for every name button. The chosen one has aria-expanded="true", so `aria-expanded:` utilities colour it.
classNamestring—Classes for the list.
  • swap is Cerette's. "fade": the panels stay laid out in the one cell and the chosen one fades in over the others in 0.4 s (Framer's spring has a bounce opacity cannot show). "rise": the old panel goes at once and the new one fades in from 18 px lower on a 1 s tween, cubic-bezier(.59,.25,.12,1.17), which overshoots about 2–3%; nothing plays before the first change, so the page never opens on an animation. Framer's rise leaves the cell almost empty for ~280 ms (opacity 0.12 at 281 ms), and so does this. Either way a panel that is not chosen is inert and aria-hidden the moment the choice changes, not when the fade ends. The panels' photos are all in the page, so give them loading="lazy". Cerette dims the other names to 0.5 (dimmed={0.5}); the default stays 0.65 for contrast. At 0.5 a small role line inside a name measures 3.0 to 4.5:1 in the sample themes, because the button's opacity multiplies everything in it, so keep dimmed at 0.65 or above when a name carries small text.
  • sticky holds the panel beside the list while a long list scrolls past it: self-start and position sticky, top from the prop. It does nothing in the narrow layout. It stops working under an ancestor with overflow hidden or auto (overflow: clip is fine); the team example scrolls inside its own box for that reason.
  • One name is always chosen. Pointing at a name chooses it and it stays chosen when the pointer leaves; a click or Enter chooses it on any device. When the list is under 576 px wide the panel opens under its name by height, and a click on the open name leaves it open.
  • The layout follows the width of the list, not of the window (a container query at 576 px), so it works in a sidebar or a card; Tustel's breakpoints are the window's and broke there. Each panel is in the page once, inside its own list item. When there is room the list becomes a grid and every panel sits in the same cell beside the names, so the content is not duplicated for the two layouts (a copy would repeat ids and state). The names space out if a panel is taller than the list.
  • Pointing only counts for a mouse, and while the panel is beside the list; touch and keyboard use a click or Enter. Whether it is beside the list is read from the list's computed display when the pointer arrives, never while rendering.
  • Tustel dims the other names to 30%, which is 2.1:1 against white. The library steps them back to 65%: 6.3:1 in the default theme, 8:1 in dark, and 5.1:1 or better in all four Blocks sample themes, light and dark (60% was 4.4 in the "soft" theme). Tustel's orange on the chosen name is left out — colour it with `nameClassName`.
  • The names and the phone accordion use Framer's springSoft (bounce 0.2, 0.4 s); the panel beside the list changes at once by default, as in Tustel (see swap). Reduced motion is a zero-duration transition, not different markup.

AI prompt

Paste into v0, Lovable, Bolt or Claude to rebuild this component in your own project.

Create a React + Tailwind CSS + Motion (motion/react) component called IndexList.
- Wrap everything in a div with the @container class (a container query, so the layout follows the list's own width). Inside
  it, a ul with an aria-label: flex column with gap-6; from the @xl container size (576px) a grid with columns minmax(0,1fr)
  and minmax(0,min(var(--index-panel),55%)) (the panel width, default 360px) and gap-x-12. Each li is flex column and, from
  @xl, display: contents, so its name and its panel become grid items of the ul.
- Each name is a motion.button: type button, aria-expanded, aria-controls its panel, text-2xl font-semibold
  tracking-tight (text-3xl from @xl), left-aligned, rounded-md, ring-[3px] ring-ring/50 on focus-visible; an optional
  marker (tabular-nums) comes before the title. It sits in grid column 1. Exactly one name is chosen (the first by
  default); the chosen name animates to opacity 1 and the rest to 0.65 with a spring (bounce 0.2, duration 0.4s).
  Controlled (value, onValueChange) or uncontrolled (defaultValue).
- A click or Enter chooses a name. With trigger="hover", onPointerEnter chooses it too, only for pointerType "mouse" and
  only when the ul's computed display is grid (the panel is beside the list) — read it inside the handler, never while rendering. The chosen name
  stays chosen when the pointer leaves.
- Each panel is a motion.div with role region, aria-labelledby its name, inert while closed and a data-state attribute.
  Narrow, it has overflow hidden and animates height between 0 and auto with the same spring, so the chosen name opens
  under itself and a click on the open one leaves it open. From @xl it is placed in grid column 2 and row 1 spanning all
  rows (inline gridRow: "1 / span var(--index-rows)", the row count set on the ul), centred vertically, with height:auto
  forced (md:h-auto!) and overflow visible; a closed panel is display: none. By default no cross-fade: the panel changes at once.
- swap="fade": closed panels stay laid out and are opacity-0 with a 400ms opacity transition instead of display: none. swap="rise": a keyframe
  (opacity 0 and translateY(18px) to rest, 1s, cubic-bezier(.59,.25,.12,1.17), backwards fill) plays on the panel that becomes open, only
  after the first change and only from the @xl container size; reduced motion turns it off. Closed panels are always aria-hidden and inert.
- sticky (px): from @xl the panel is self-start sticky with top set to that value, instead of centred.
- Use useReducedMotion() only to switch the transitions to zero duration — never to change the markup. Ids come from
  useId and the index.

Be the first to know

Get new templates and components first

One short email when we release a template or a free component. No spam — unsubscribe anytime.

We use your email only for Framebrick updates. Privacy policy