Expanding Panels

A row of image strips; the one you hover, focus or tap opens wide and shows its text.

  • Roasted coffee beans on the steel counter, with the same cobalt cup behind them.

    Washed lots from four farms, bought green and roasted every Monday.

  • A slender stream of coffee pours into the cobalt cup.
  • A cobalt ceramic cup of coffee on a brushed steel counter in morning light.
import { ExpandingPanels } from '@brand-studio/ui';
import { beans, cup, pour } from '@/demos/assets';

export default function ExpandingPanelsDemo() {
  return (
    <div style={{ width: '100%', maxWidth: 880 }}>
      <ExpandingPanels label="How we make a cup" panels={[
        { id: 'bean', title: 'The bean', asset: beans, body: <p>Washed lots from four farms, bought green and roasted every Monday.</p> },
        { id: 'pour', title: 'The pour', asset: pour, body: <p>Ninety-four degrees, a thirty-second bloom and a slow spiral.</p> },
        { id: 'cup', title: 'The cup', asset: cup, body: <p>Stone fruit, brown sugar and a long, clean finish.</p> },
      ]} />
    </div>
  );
}

Installation

pnpm add @brand-studio/ui

Usage

import { ExpandingPanels } from '@brand-studio/ui';
<ExpandingPanels label="How we make a cup" panels={[
  { id: 'bean', title: 'The bean', asset: beans, body: <p>Roasted every Monday.</p> },
  { id: 'pour', title: 'The pour', asset: pour, body: <p>A thirty-second bloom.</p> },
]} />

Three to five panels work best. On screens under 640px the strips stack and the open one grows taller.

Accessibility

  • Each strip's title is a button that reports whether its panel is open, and controls the text it reveals.
  • Keyboard focus opens a strip, so tabbing walks through them.
  • A mouse opens strips on hover; touch opens them on tap.

API Reference

PropTypeDefault
panelsPanel[]–
label?string'Panels'
className?string''

Still, Deskhand and Hollis are fictional brands. The coffee photographs are original generated artwork. @brand-studio/ui is MIT licensed.