Feature tabs with autoplay
Vertical feature tabs with a progress line that fills and moves on to the next tab, while a code-drawn product preview changes beside them.
"use client";
import {
useEffect,
useRef,
useState,
type CSSProperties,
type KeyboardEvent,
type ReactElement,
} from "react";
import "./feature-tabs.css";
const DURATION = 6000;
/* Tiny code-drawn previews for each tab. Replace with screenshots or videos. */
const Inbox = () => (
<div className="gu-ftabs__mock gu-ftabs__mock--inbox">
{[
"Invoice #2041 paid",
"New comment on Homepage v3",
"Deploy finished in 41s",
"Maya assigned you a task",
].map((t, i) => (
<div key={t} style={{ "--i": i } as CSSProperties}>
<span />
<b>{t}</b>
<small>{2 + i * 7}m</small>
</div>
))}
</div>
);
const Chart = () => (
<div className="gu-ftabs__mock gu-ftabs__mock--chart">
<b>$48,210</b>
<small>Revenue this month · +12.4%</small>
<div>
{[38, 52, 44, 61, 58, 72, 66, 84, 79, 92, 88, 100].map((h, i) => (
<span key={i} style={{ "--h": `${h}%`, "--i": i } as CSSProperties} />
))}
</div>
</div>
);
const Flow = () => (
<div className="gu-ftabs__mock gu-ftabs__mock--flow">
{[
"When a form is sent",
"Add to CRM",
"Send welcome email",
"Notify #sales",
].map((t, i) => (
<div key={t} style={{ "--i": i } as CSSProperties}>
<span>{i === 0 ? "⚡" : i}</span>
{t}
</div>
))}
</div>
);
const TABS: { title: string; text: string; Preview: () => ReactElement }[] = [
{
title: "One inbox for everything",
text: "Payments, comments, deploys and tasks land in one calm list, sorted by what needs you first.",
Preview: Inbox,
},
{
title: "Numbers that explain themselves",
text: "Live revenue and usage charts with plain-language notes about what changed and why.",
Preview: Chart,
},
{
title: "Automations without code",
text: "Chain triggers and actions in a few clicks. No scripts, no servers, no surprises.",
Preview: Flow,
},
];
/**
* FeatureTabs
* - WAI-ARIA tabs (vertical): Up/Down arrows move between tabs, Home/End jump.
* - Autoplay advances every DURATION ms and stops forever after the first interaction.
*/
export function FeatureTabs({ theme = "light" }: { theme?: "light" | "dark" }) {
const [active, setActive] = useState(0);
const [auto, setAuto] = useState(true);
const tabs = useRef<(HTMLButtonElement | null)[]>([]);
useEffect(() => {
if (!auto || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
const t = setTimeout(
() => setActive((a) => (a + 1) % TABS.length),
DURATION,
);
return () => clearTimeout(t);
}, [active, auto]);
const pick = (i: number, focus = false) => {
setAuto(false);
setActive(i);
if (focus) tabs.current[i]?.focus();
};
const onKey = (e: KeyboardEvent) => {
const n = TABS.length;
const map: Record<string, number> = {
ArrowDown: active + 1,
ArrowUp: active - 1,
Home: 0,
End: n - 1,
};
if (!(e.key in map)) return;
e.preventDefault();
pick((map[e.key] + n) % n, true);
};
const { Preview } = TABS[active];
return (
<section className="gu-ftabs" data-theme={theme}>
<h2>Run the whole studio from one place.</h2>
<div className="gu-ftabs__grid">
<div
role="tablist"
aria-orientation="vertical"
aria-label="Features"
className="gu-ftabs__list"
onKeyDown={onKey}
>
{TABS.map((t, i) => (
<button
key={t.title}
ref={(el) => {
tabs.current[i] = el;
}}
role="tab"
id={`gu-ftab-${i}`}
aria-selected={active === i}
aria-controls="gu-ftab-panel"
tabIndex={active === i ? 0 : -1}
onClick={() => pick(i)}
className="gu-ftabs__tab"
>
<span className="gu-ftabs__line" aria-hidden="true">
{active === i && (
<i
key={`${active}-${auto}`}
data-auto={auto ? "" : undefined}
style={{ "--dur": `${DURATION}ms` } as CSSProperties}
/>
)}
</span>
<b>{t.title}</b>
<span className="gu-ftabs__text">
<span>{t.text}</span>
</span>
</button>
))}
</div>
<div
className="gu-ftabs__stage"
role="tabpanel"
id="gu-ftab-panel"
aria-labelledby={`gu-ftab-${active}`}
>
<div key={active} className="gu-ftabs__frame">
<div className="gu-ftabs__dots" aria-hidden="true">
<i />
<i />
<i />
</div>
<Preview />
</div>
</div>
</div>
</section>
);
}
Paste this into ChatGPT, Claude, Cursor, v0, Lovable or Bolt. It describes the layout, motion, colors and accessibility and includes the code, so the AI can rebuild it in any framework.
# Build this UI piece: Feature tabs with autoplay
You are a senior front-end engineer. Recreate the piece below in my project. If I don't say which framework I use, ask once, then build it in that framework (React, Vue, Svelte, Angular, Astro, plain HTML/CSS/JS or anything else). Keep the behavior, motion, colors, spacing and accessibility exactly as described. Keep the code clean and commented for beginners.
## What it is
A product feature section with vertical tabs on the left and a framed app preview on the right. Each tab has a thin line that fills over 6 seconds, then the next tab opens; the active tab's description expands; the preview animates its contents in.
## Layout and look
- Cream section (dark Ink). Headline "Run the whole studio from one place." (clamp 35–77px, weight 900, max 14ch).
- Grid 0.9fr / 1.3fr; stacks under 760px.
- Tabs: a 3px vertical line (gray, the active one fills orange top-down), title 18–23px weight 800 (muted until active), description opening below.
- Stage: 5:4 Ink panel (orange in dark mode) with radius 28px holding a dark "app window" with three dots and a code-drawn mock: an inbox list, a bar chart with a lime last bar, or an automation flow with connectors.
## Behavior and motion
1. Autoplay every 6s; any click or key stops it for good and the line shows full.
2. Descriptions open with grid-template-rows 0fr → 1fr (500ms cubic-bezier(0.16, 1, 0.3, 1)).
3. The window rises 18px and scales from 0.97; inner rows stagger by 70ms; chart bars grow from the bottom.
## Touch
Tapping a tab stops autoplay; one column on phones.
## Accessibility
- role="tablist" with aria-orientation="vertical", roving tabindex, Up/Down/Home/End keys, tabpanel labelled by the active tab.
- prefers-reduced-motion: no autoplay, simple fades.
## Props
theme. Edit TABS and DURATION; swap the mocks for screenshots.
## Reference implementation
The original is written in React with one plain CSS file. Dependencies: none (plain React and CSS). Translate it faithfully; do not add new libraries unless my framework needs them.
### FeatureTabs.tsx
```tsx
"use client";
import {
useEffect,
useRef,
useState,
type CSSProperties,
type KeyboardEvent,
type ReactElement,
} from "react";
import "./feature-tabs.css";
const DURATION = 6000;
/* Tiny code-drawn previews for each tab. Replace with screenshots or videos. */
const Inbox = () => (
<div className="gu-ftabs__mock gu-ftabs__mock--inbox">
{[
"Invoice #2041 paid",
"New comment on Homepage v3",
"Deploy finished in 41s",
"Maya assigned you a task",
].map((t, i) => (
<div key={t} style={{ "--i": i } as CSSProperties}>
<span />
<b>{t}</b>
<small>{2 + i * 7}m</small>
</div>
))}
</div>
);
const Chart = () => (
<div className="gu-ftabs__mock gu-ftabs__mock--chart">
<b>$48,210</b>
<small>Revenue this month · +12.4%</small>
<div>
{[38, 52, 44, 61, 58, 72, 66, 84, 79, 92, 88, 100].map((h, i) => (
<span key={i} style={{ "--h": `${h}%`, "--i": i } as CSSProperties} />
))}
</div>
</div>
);
const Flow = () => (
<div className="gu-ftabs__mock gu-ftabs__mock--flow">
{[
"When a form is sent",
"Add to CRM",
"Send welcome email",
"Notify #sales",
].map((t, i) => (
<div key={t} style={{ "--i": i } as CSSProperties}>
<span>{i === 0 ? "⚡" : i}</span>
{t}
</div>
))}
</div>
);
const TABS: { title: string; text: string; Preview: () => ReactElement }[] = [
{
title: "One inbox for everything",
text: "Payments, comments, deploys and tasks land in one calm list, sorted by what needs you first.",
Preview: Inbox,
},
{
title: "Numbers that explain themselves",
text: "Live revenue and usage charts with plain-language notes about what changed and why.",
Preview: Chart,
},
{
title: "Automations without code",
text: "Chain triggers and actions in a few clicks. No scripts, no servers, no surprises.",
Preview: Flow,
},
];
/**
* FeatureTabs
* - WAI-ARIA tabs (vertical): Up/Down arrows move between tabs, Home/End jump.
* - Autoplay advances every DURATION ms and stops forever after the first interaction.
*/
export function FeatureTabs({ theme = "light" }: { theme?: "light" | "dark" }) {
const [active, setActive] = useState(0);
const [auto, setAuto] = useState(true);
const tabs = useRef<(HTMLButtonElement | null)[]>([]);
useEffect(() => {
if (!auto || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
const t = setTimeout(
() => setActive((a) => (a + 1) % TABS.length),
DURATION,
);
return () => clearTimeout(t);
}, [active, auto]);
const pick = (i: number, focus = false) => {
setAuto(false);
setActive(i);
if (focus) tabs.current[i]?.focus();
};
const onKey = (e: KeyboardEvent) => {
const n = TABS.length;
const map: Record<string, number> = {
ArrowDown: active + 1,
ArrowUp: active - 1,
Home: 0,
End: n - 1,
};
if (!(e.key in map)) return;
e.preventDefault();
pick((map[e.key] + n) % n, true);
};
const { Preview } = TABS[active];
return (
<section className="gu-ftabs" data-theme={theme}>
<h2>Run the whole studio from one place.</h2>
<div className="gu-ftabs__grid">
<div
role="tablist"
aria-orientation="vertical"
aria-label="Features"
className="gu-ftabs__list"
onKeyDown={onKey}
>
{TABS.map((t, i) => (
<button
key={t.title}
ref={(el) => {
tabs.current[i] = el;
}}
role="tab"
id={`gu-ftab-${i}`}
aria-selected={active === i}
aria-controls="gu-ftab-panel"
tabIndex={active === i ? 0 : -1}
onClick={() => pick(i)}
className="gu-ftabs__tab"
>
<span className="gu-ftabs__line" aria-hidden="true">
{active === i && (
<i
key={`${active}-${auto}`}
data-auto={auto ? "" : undefined}
style={{ "--dur": `${DURATION}ms` } as CSSProperties}
/>
)}
</span>
<b>{t.title}</b>
<span className="gu-ftabs__text">
<span>{t.text}</span>
</span>
</button>
))}
</div>
<div
className="gu-ftabs__stage"
role="tabpanel"
id="gu-ftab-panel"
aria-labelledby={`gu-ftab-${active}`}
>
<div key={active} className="gu-ftabs__frame">
<div className="gu-ftabs__dots" aria-hidden="true">
<i />
<i />
<i />
</div>
<Preview />
</div>
</div>
</div>
</section>
);
}
```
### feature-tabs.css
```css
/* FeatureTabs: change these colors to match your brand. */
.gu-ftabs {
--bg: #f3eee3;
--card: #fbf8f2;
--stage: #0e0e10;
--screen: #18181b;
--screen-text: #f3eee3;
--text: #0e0e10;
--muted: #57534b;
--line: rgb(14 14 16 / 0.14);
--accent: #ff5a1f;
--volt: #d7ff3a;
--focus: #2b35ff;
--ease: cubic-bezier(0.16, 1, 0.3, 1);
container-type: inline-size;
padding: clamp(40px, 7%, 96px) clamp(16px, 4%, 48px);
background: var(--bg);
color: var(--text);
font-family: system-ui, sans-serif;
}
.gu-ftabs[data-theme="dark"] {
--bg: #0e0e10;
--card: #18181b;
--stage: #ff5a1f;
--screen: #0e0e10;
--text: #f3eee3;
--muted: #aea89c;
--line: rgb(243 238 227 / 0.14);
--focus: #d7ff3a;
}
.gu-ftabs h2 {
max-width: 14ch;
margin: 0 auto clamp(28px, 5cqi, 56px) 0;
font-size: clamp(2.2rem, 6.5cqi, 4.8rem);
font-weight: 900;
letter-spacing: -0.05em;
line-height: 0.92;
}
.gu-ftabs__grid {
display: grid;
grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr);
gap: clamp(24px, 5cqi, 64px);
align-items: center;
}
.gu-ftabs__list {
display: grid;
}
.gu-ftabs__tab {
display: grid;
grid-template-columns: 3px 1fr;
column-gap: 20px;
padding: 18px 0;
border: 0;
background: none;
color: var(--muted);
font: inherit;
text-align: left;
cursor: pointer;
}
.gu-ftabs__tab:focus-visible {
outline: 3px solid var(--focus);
outline-offset: 4px;
border-radius: 8px;
}
.gu-ftabs__line {
grid-row: 1 / span 2;
position: relative;
overflow: hidden;
border-radius: 3px;
background: var(--line);
}
.gu-ftabs__line i {
position: absolute;
inset: 0;
background: var(--accent);
}
.gu-ftabs__line i[data-auto] {
transform-origin: top;
animation: gu-ftabs-fill var(--dur) linear;
}
@keyframes gu-ftabs-fill {
from {
transform: scaleY(0);
}
}
.gu-ftabs__tab b {
font-size: clamp(1.1rem, 2.4cqi, 1.45rem);
font-weight: 800;
letter-spacing: -0.02em;
transition: color 0.3s;
}
.gu-ftabs__tab:hover b,
.gu-ftabs__tab[aria-selected="true"] b {
color: var(--text);
}
/* Description opens with the 0fr → 1fr grid trick */
.gu-ftabs__text {
display: grid;
grid-template-rows: 0fr;
transition: grid-template-rows 0.5s var(--ease);
}
.gu-ftabs__text > span {
overflow: hidden;
line-height: 1.5;
}
.gu-ftabs__tab[aria-selected="true"] .gu-ftabs__text {
grid-template-rows: 1fr;
}
.gu-ftabs__tab[aria-selected="true"] .gu-ftabs__text > span {
padding-top: 8px;
}
.gu-ftabs__stage {
display: grid;
place-items: center;
aspect-ratio: 5 / 4;
padding: 8%;
border-radius: 28px;
background: var(--stage);
}
.gu-ftabs__frame {
width: 100%;
padding: 14px;
border-radius: 18px;
background: var(--screen);
color: var(--screen-text);
box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.6);
animation: gu-ftabs-in 0.6s var(--ease);
}
@keyframes gu-ftabs-in {
from {
opacity: 0;
transform: translateY(18px) scale(0.97);
}
}
.gu-ftabs__dots {
display: flex;
gap: 6px;
margin-bottom: 12px;
}
.gu-ftabs__dots i {
width: 9px;
height: 9px;
border-radius: 50%;
background: rgb(243 238 227 / 0.25);
}
.gu-ftabs__mock > * {
animation: gu-ftabs-in 0.5s calc(var(--i, 0) * 70ms + 0.1s) var(--ease) both;
}
.gu-ftabs__mock--inbox {
display: grid;
gap: 6px;
}
.gu-ftabs__mock--inbox div {
display: grid;
grid-template-columns: 10px 1fr auto;
align-items: center;
gap: 10px;
padding: 12px;
border-radius: 10px;
background: rgb(243 238 227 / 0.06);
font-size: 0.85rem;
}
.gu-ftabs__mock--inbox span {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--accent);
}
.gu-ftabs__mock--inbox div:nth-child(n + 3) span {
background: rgb(243 238 227 / 0.2);
}
.gu-ftabs__mock small {
opacity: 0.6;
}
.gu-ftabs__mock--chart b {
display: block;
font-size: 1.8rem;
font-weight: 900;
letter-spacing: -0.04em;
}
.gu-ftabs__mock--chart > div {
display: flex;
align-items: flex-end;
gap: 5px;
height: 120px;
margin-top: 14px;
}
.gu-ftabs__mock--chart span {
flex: 1;
height: var(--h);
border-radius: 4px 4px 0 0;
background: var(--accent);
transform-origin: bottom;
animation: gu-ftabs-bar 0.7s calc(var(--i) * 40ms) var(--ease) both;
}
.gu-ftabs__mock--chart span:last-child {
background: var(--volt);
}
@keyframes gu-ftabs-bar {
from {
transform: scaleY(0);
}
}
.gu-ftabs__mock--flow {
display: grid;
gap: 18px;
padding: 6px 4px;
}
.gu-ftabs__mock--flow div {
position: relative;
display: flex;
align-items: center;
gap: 12px;
padding: 10px 12px;
border: 1px solid rgb(243 238 227 / 0.14);
border-radius: 12px;
font-size: 0.88rem;
font-weight: 600;
}
.gu-ftabs__mock--flow div + div::before {
content: "";
position: absolute;
top: -19px;
left: 25px;
width: 2px;
height: 18px;
background: rgb(243 238 227 / 0.25);
}
.gu-ftabs__mock--flow span {
display: grid;
place-items: center;
width: 28px;
height: 28px;
border-radius: 8px;
background: rgb(243 238 227 / 0.1);
font-size: 0.8rem;
font-weight: 800;
}
.gu-ftabs__mock--flow div:first-child span {
background: var(--volt);
color: #0e0e10;
}
@container (max-width: 760px) {
.gu-ftabs__grid {
grid-template-columns: 1fr;
}
}
@media (prefers-reduced-motion: reduce) {
.gu-ftabs__frame,
.gu-ftabs__mock > *,
.gu-ftabs__mock--chart span {
animation: gu-ftabs-fade 0.2s both;
}
@keyframes gu-ftabs-fade {
from {
opacity: 0;
}
}
.gu-ftabs__text {
transition: none;
}
}
```
You might also want
Next piece: File dropzoneBento features grid
Templates, intermediate
FAQ accordion
Templates, beginner
Integrations orbit
Templates, intermediate