Dynamic Island
dynamic-islandA black pill that morphs on a spring to fit whatever it is showing: a timer, a call, a song or a notification. Content swaps through a short blur crossfade, the corners never stretch mid-morph, and each change is announced politely.
"use client";
import { Pause, Phone, SkipBack, SkipForward, Timer } from "lucide-react";
import { useEffect, useState } from "react";
import { Button } from "@/components/forme/button/button";
import { DynamicIsland } from "@/components/forme/dynamic-island/dynamic-island";
type View = "idle" | "timer" | "music" | "call" | "notification";
const views: { value: View; label: string }[] = [
{ value: "idle", label: "Idle" },
{ value: "timer", label: "Timer" },
{ value: "music", label: "Music" },
{ value: "call", label: "Call" },
{ value: "notification", label: "Deploy" },
];
export function DynamicIslandDemo() {
const [view, setView] = useState<View>("music");
const [seconds, setSeconds] = useState(272);
useEffect(() => {
const timer = setInterval(() => setSeconds((value) => (value > 0 ? value - 1 : 300)), 1000);
return () => clearInterval(timer);
}, []);
const clock = `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
return (
<div className="flex w-full flex-col items-center gap-8 py-4">
<div className="flex min-h-40 items-start">
<DynamicIsland view={view} announce={`Showing ${view}`}>
{view === "idle" ? <div className="h-9 w-32" /> : null}
{view === "timer" ? (
<div className="flex h-9 w-56 items-center justify-between px-3.5">
<Timer aria-hidden className="size-4 text-warning" />
<span className="font-mono text-body-medium text-warning tabular-nums">{clock}</span>
</div>
) : null}
{view === "call" ? (
<div className="flex h-9 w-64 items-center justify-between ps-1.5 pe-1.5">
<span className="flex items-center gap-2">
<span className="grid size-6 place-items-center rounded-full bg-success text-black">
<Phone aria-hidden className="size-3.5" />
</span>
<span className="text-caption-1-semibold">Lin · 03:12</span>
</span>
<span aria-hidden className="flex h-4 items-center gap-0.5 pe-2">
{[0.5, 1, 0.7, 0.9, 0.4].map((height, index) => (
<span
key={index}
className="w-0.5 animate-pulse rounded-full bg-success"
style={{ height: `${height * 100}%`, animationDelay: `${index * 120}ms` }}
/>
))}
</span>
</div>
) : null}
{view === "music" ? (
<div className="w-[22rem] p-4">
<div className="flex items-center gap-3">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src="/images/cover2.webp" alt="" className="size-12 rounded-xl object-cover" />
<div className="min-w-0 flex-1">
<p className="truncate text-body-semibold">Low Tide</p>
<p className="truncate text-caption-1-regular text-white/60">Halcyon Fields</p>
</div>
<span aria-hidden className="flex h-5 items-end gap-0.5">
{[0.6, 1, 0.4, 0.8].map((height, index) => (
<span
key={index}
className="w-1 animate-pulse rounded-full bg-[oklch(80%_0.1_45)]"
style={{ height: `${height * 100}%`, animationDelay: `${index * 150}ms` }}
/>
))}
</span>
</div>
<div className="mt-4 flex items-center gap-2 text-caption-2-regular text-white/50 tabular-nums">
1:48
<span className="relative h-1 flex-1 overflow-hidden rounded-full bg-white/15">
<span className="absolute inset-y-0 left-0 w-[42%] rounded-full bg-white" />
</span>
-2:31
</div>
<div className="mt-3 flex items-center justify-center gap-6">
<button
type="button"
aria-label="Previous track"
className="cursor-pointer text-white/80 hover:text-white"
>
<SkipBack aria-hidden className="size-5 fill-current" />
</button>
<button type="button" aria-label="Pause" className="cursor-pointer text-white">
<Pause aria-hidden className="size-7 fill-current" />
</button>
<button
type="button"
aria-label="Next track"
className="cursor-pointer text-white/80 hover:text-white"
>
<SkipForward aria-hidden className="size-5 fill-current" />
</button>
</div>
</div>
) : null}
{view === "notification" ? (
<div className="flex w-[22rem] items-center gap-3 p-3">
<span className="grid size-10 shrink-0 place-items-center rounded-full bg-success/20 text-success">
<svg
viewBox="0 0 16 16"
aria-hidden
className="size-5"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="m3.5 8.5 3 3 6-7" />
</svg>
</span>
<div className="min-w-0 flex-1">
<p className="text-body-semibold">Deployed to production</p>
<p className="truncate text-caption-1-regular text-white/60">
forme-web · 41s · all checks passed
</p>
</div>
<button
type="button"
aria-label="Dismiss"
onClick={() => setView("idle")}
className="grid size-8 cursor-pointer place-items-center rounded-full bg-white/10 hover:bg-white/20"
>
<svg viewBox="0 0 16 16" aria-hidden className="size-3.5">
<path
d="m4.5 4.5 7 7m0-7-7 7"
stroke="currentColor"
strokeWidth="1.6"
strokeLinecap="round"
/>
</svg>
</button>
</div>
) : null}
</DynamicIsland>
</div>
<div role="group" aria-label="Island content" className="flex flex-wrap justify-center gap-2">
{views.map((entry) => (
<Button
key={entry.value}
size="small"
variant={entry.value === view ? "ghost" : "secondary"}
aria-pressed={entry.value === view}
onClick={() => setView(entry.value)}
>
{entry.label}
</Button>
))}
</div>
</div>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
Usage
import { DynamicIsland } from "@/components/forme/dynamic-island/dynamic-island";
<DynamicIsland view={view} announce={`Now showing ${view}`}>
{view === "timer" ? <Timer /> : <NowPlaying />}
</DynamicIsland>When to use
Reach for it
- A single live status that changes shape with its content: a timer, a call, the track that is playing.
- A compact notification surface that grows for a moment and settles back.
Use something else
- Content people need to read at length — it is a pill, sized to its content, not a panel.
- More than one at a time. Two islands compete for the same glance.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
DynamicIsland
A black pill that morphs to fit whatever it is showing: a timer, a call, the song that is playing, a notification.
| Prop | Type | Default | Description |
|---|---|---|---|
view* | string | — | Identifies what is showing. Change it and the island morphs to fit the new content — the key is what tells it the content is new, not just updated. |
children* | ReactNode | — | |
announce | string | — | A short description of the current view, announced politely. |
className | string | — |
Accessibility
announceis read through a polite status region wheneverviewchanges, so the change is heard as well as seen.- It is black with white content in both themes, like other media chrome, and keeps that contrast either way.
Motion
- The box morphs to the new size on a layout spring while the content swaps through a short blur crossfade.
- The radius is set inline so the corners stay round mid-morph instead of stretching.
- Reduced motion swaps the content and the size in one frame.
Related


Confirm Button
A destructive button that grows into its own confirmation on a spring, so the question appears where you are looking. Focus lands on Cancel, Esc or clicking away disarms it, and the confirm button shows a spinner while the action runs.
motion

Marquee
A seamless, endlessly scrolling row for logos, photos or testimonials. It pauses on hover and focus, screen readers hear the content once, and reduced motion turns it into a row you scroll by hand. Pure CSS.
motion

Metal Button
A button with a chrome rim whose reflections travel slowly round it, and a glint that crosses the face on hover. Plain CSS in a server component, still for reduced motion.
motion
