Dynamic Island

A functional iPhone-inspired island that morphs between compact and expanded content.

Dynamic Island is a small interactive surface for media, timers, calls, or notifications. The default preview is an empty pill; tap it to see the unavailable-activity response.

Preview

Installation

$ npx shadcn@latest add https://spark-ui-olive.vercel.app/r/dynamic-island.json

Usage

import { DynamicIsland } from "@/components/dynamic-island";
export default function DynamicIslandDemo() {
  return <DynamicIsland />;
}

Empty State and Spotify Playback

With no compact or expanded content, the island grows, shakes horizontally, then returns to its original size. Use the button below to play the real Spotify preview and activate the island without shaking it. Then tap the active island to smoothly expand it and the still-playing Spotify Card together, without sliding the card upward.

Play the preview to activate the Dynamic Island.

Activity Examples

Use the same component for secure actions, media playback, live calls, and notifications. Choose an activity below, tap the island to expand it, then try its controls.

Controlled State

Pass open and onOpenChange when another part of your app needs to control the island.

const [open, setOpen] = useState(false);

<DynamicIsland
  open={open}
  onOpenChange={setOpen}
  compact={<span>Now playing</span>}
  expanded={<div>Playback controls</div>}
/>;

Properties

PropTypeDefaultDescription
compactReactNodeemptyNon-interactive content shown inside the compact pill.
expandedReactNodeContent shown in the expanded panel. Omit it to keep the component pill-shaped when enlarged.
openbooleanControlled expanded state.
defaultOpenbooleanfalseInitial expanded state when the component is uncontrolled.
onOpenChange(open: boolean) => voidCalled whenever the island requests an expand or collapse.
expandLabelstringExpand Dynamic IslandAccessible label for the compact expand button.
collapseLabelstringCollapse Dynamic IslandAccessible label for the expanded collapse handle.
classNamestringAdditional classes for the island container.

Accessibility

  • Expand and collapse controls are native buttons with customizable labels.
  • Pressing Escape while focus is inside the expanded island collapses it.
  • Focus returns to the compact trigger after the island closes.
  • Morphing animations respect the user's reduced-motion preference.