Open this example in the interactive library
Live preview
Source code
// components/TransitionDrivenPanelSelection.tsx
import { useState, useTransition } from "react";
export default function TransitionDrivenPanelSelection() {
const [tab, set] = useState("Summary");
const [pending, start] = useTransition();
return (
<section aria-busy={pending}>
{["Summary", "History"].map((t) => (
<button key={t} aria-pressed={tab === t} onClick={() => start(() => set(t))}>
{t}
</button>
))}
<h2>{tab}</h2>
</section>
);
}
