Dynamic Island
Dynamic Island is an iOS-style pill that morphs into live activity views. Its shell springs between sizes with blur and scale crossfades, and it is built with motion/react.


shadcn add · no workarounds · theme from registry.jsonInstallation
Requires @beui in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { useState } from 'react'; import { DynamicIsland, DynamicIslandView } from '@/components/motion/dynamic-island'; export function Island() { const [view, setView] = useState<string | null>(null); return (<DynamicIsland view={view} compact={<span>Timer</span>}> <DynamicIslandView id='timer'><button onClick={() => setView(null)}>Stop</button></DynamicIslandView> </DynamicIsland>); }- Showing a persistent, glanceable status such as a timer, music, call, or delivery progress in a compact top-center pill that expands on demand
- Surfacing transient live activity with an iPhone-like morph where the shell resizes smoothly instead of snapping
- Building a notch-style status indicator that switches between several contextual views by id
- Demonstrating shared layout morphing where a compact label expands into a detailed control panel
Examples
Compact pill with a single expandable view
Tapping the compact pill opens the timer view. The view closes when the user taps Stop, which sets view back to null.
'use client'; import { useState } from 'react'; import { DynamicIsland, DynamicIslandView } from '@/components/motion/dynamic-island'; export default function TimerIsland() { const [view, setView] = useState<string | null>(null); return (<div className='flex justify-center pt-4'> <DynamicIsland view={view} compact={<button onClick={() => setView('timer')}>12:40</button>}> <DynamicIslandView id='timer'> <div className='flex items-center gap-4 text-sm'><span>Focus 12:40</span><button onClick={() => setView(null)}>Stop</button></div> </DynamicIslandView> </DynamicIsland> </div>); }Switching between multiple views
Several DynamicIslandView children share one island. Only the view whose id matches the active view prop is rendered.
'use client'; import { useState } from 'react'; import { DynamicIsland, DynamicIslandView } from '@/components/motion/dynamic-island'; export default function MediaIsland() { const [view, setView] = useState<string | null>(null); return (<div className='flex justify-center pt-4'> <DynamicIsland view={view} compact={<span>Now playing</span>}> <DynamicIslandView id='music'><button onClick={() => setView('volume')}>Music</button></DynamicIslandView> <DynamicIslandView id='volume'><input type='range' aria-label='Volume' /></DynamicIslandView> </DynamicIsland> <button onClick={() => setView(view ? null : 'music')}>Toggle</button> </div>); }Custom styling on the shell and a view
The className prop on DynamicIsland styles the outer shell, and className on DynamicIslandView styles that slot's padding and layout.
'use client'; import { DynamicIsland, DynamicIslandView } from '@/components/motion/dynamic-island'; export default function DeliveryIsland() { return (<DynamicIsland view='delivery' compact={<span>On the way</span>} className='max-w-sm'> <DynamicIslandView id='delivery' className='gap-3 px-5'><span>Arriving in 5 min</span></DynamicIslandView> </DynamicIsland>); }API reference
Accessibility
- The shell is a div with role='status' and aria-live='polite', so view changes and compact content are announced politely without interrupting the user.
- When reduced motion is preferred (useReducedMotion), the shell duration drops to 0 and slot transitions shorten to about 0.1 to 0.15s with blur removed.
- Interactive controls inside views (buttons, inputs) must have accessible names because they are rendered inside a live region.
- DynamicIslandView throws an error if used outside DynamicIsland, so always nest views within the island.
- Provide visible focus styles on buttons inside the pill, since the dark background needs sufficient contrast.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Dynamic Island" component (beui/dynamic-island) from its shadcn registry.1. Install it with: npx shadcn@latest add @beui/dynamic-island2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: view, compact, children, className.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { useState } from 'react'; import { DynamicIsland, DynamicIslandView } from '@/components/motion/dynamic-island'; export function Island() { const [view, setView] = useState<string | null>(null); return (<DynamicIsland view={view} compact={<span>Timer</span>}> <DynamicIslandView id='timer'><button onClick={() => setView(null)}>Stop</button></DynamicIslandView> </DynamicIsland>); }```Files & dependencies
- components/motion/dynamic-island.tsx→ @components/motion/dynamic-island.tsx
- lib/ease.ts→ @lib/ease.ts
- lib/utils.ts→ @lib/utils.ts