Rendyn

Component library

189 components

Product blocks

Dynamic Island

Dynamic Island switches between compact content and a view selected by ID.

Interactive exampleReact Tailwind CSS

Practical React example

Show one compact task indicator that can expand into a named detail view.

Before you copy and paste

Keep the example in the React rendering environment required by the imported component. Copy components/motion/dynamic-island.tsx and its returned support files from the Code tab; preserve the project-relative paths.

Listed package dependencies: clsx, lucide-react, motion, react, tailwind-merge.

Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.

Show one compact task indicator that can expand into a named detail view

// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";

import { Music, Phone, PhoneOff, Timer } from "lucide-react";
import { motion, useReducedMotion } from "motion/react";
import { useEffect, useState } from "react";
import { Button } from "@/components/motion/button";
import {
  DynamicIsland,
  DynamicIslandView,
} from "@/components/motion/dynamic-island";
import { NumberTicker } from "@/components/motion/number-ticker";

type IslandView = "call" | "timer" | "music" | null;

const BAR_DELAYS = [0, 0.18, 0.09, 0.27];

function EqBars() {
  const reduce = useReducedMotion();
  return (
    <span className="flex h-4 items-end gap-0.5" aria-hidden>
      {BAR_DELAYS.map((delay) => (
        <motion.span
          key={delay}
          animate={reduce ? undefined : { scaleY: [0.4, 1, 0.55, 0.9, 0.4] }}
          transition={{
            duration: 1.1,
            repeat: Infinity,
            ease: "easeInOut",
            delay,
          }}
          className="h-full w-0.5 origin-bottom rounded-full bg-(--color-success)"
          style={{ scaleY: 0.6 }}
        />
      ))}
    </span>
  );
}

function formatClock(totalSeconds: number) {
  const m = Math.floor(totalSeconds / 60);
  const s = totalSeconds % 60;
  return `${m}:${String(s).padStart(2, "0")}`;
}

export function DynamicIslandPreview() {
  const [view, setView] = useState<IslandView>(null);
  const [seconds, setSeconds] = useState(154);

  useEffect(() => {
    if (view !== "timer") return;
    const id = window.setInterval(() => {
      setSeconds((s) => (s > 0 ? s - 1 : 0));
    }, 1000);
    return () => window.clearInterval(id);
  }, [view]);

  return (
    <div className="flex w-full flex-col items-center gap-4">
      {/* Fixed-height, top-aligned zone: the island stays pinned at the top
          like under a notch and unfurls downward into reserved space. */}
      <div className="flex h-32 w-full items-start justify-center pt-2">
        <DynamicIsland
          view={view}
          compact={
            <>
              <span className="h-1.5 w-1.5 rounded-full bg-(--color-success)" />
              <span>9:41</span>
            </>
          }
        >
          <DynamicIslandView id="call" className="gap-4">
            <div className="flex flex-col">
              <span className="text-[10px] uppercase tracking-wider opacity-60">
                Incoming call
              </span>
              <span className="text-sm font-semibold">Saurabh</span>
            </div>
            <div className="flex items-center gap-2">
              <button
                type="button"
                aria-label="Decline"
                onClick={() => setView(null)}
                className="flex h-8 w-8 items-center justify-center rounded-full bg-destructive text-white"
              >
                <PhoneOff className="h-3.5 w-3.5" />
              </button>
              <button
                type="button"
                aria-label="Accept"
                onClick={() => setView(null)}
                className="flex h-8 w-8 items-center justify-center rounded-full bg-(--color-success) text-white"
              >
                <Phone className="h-3.5 w-3.5" />
              </button>
            </div>
          </DynamicIslandView>

          <DynamicIslandView id="timer" className="gap-3">
            <Timer className="h-4 w-4 text-(--color-warning)" />
            <span className="text-[10px] uppercase tracking-wider opacity-60">
              Timer
            </span>
            <NumberTicker
              value={seconds}
              format={formatClock}
              startOnView={false}
              duration={0.5}
              className="text-sm font-semibold"
            />
          </DynamicIslandView>

          <DynamicIslandView id="music" className="gap-3">
            <span className="flex h-7 w-7 items-center justify-center rounded-lg bg-background/15">
              <Music className="h-3.5 w-3.5" />
            </span>
            <div className="flex flex-col text-left">
              <span className="text-xs font-semibold leading-tight">
                Midnight City
              </span>
              <span className="text-[10px] opacity-60">M83</span>
            </div>
            <EqBars />
          </DynamicIslandView>
        </DynamicIsland>
      </div>

      <div className="flex flex-wrap items-center justify-center gap-2">
        <Button size="sm" variant="secondary" onClick={() => setView("call")}>
          Call
        </Button>
        <Button
          size="sm"
          variant="secondary"
          onClick={() => {
            setSeconds(154);
            setView("timer");
          }}
        >
          Timer
        </Button>
        <Button size="sm" variant="secondary" onClick={() => setView("music")}>
          Music
        </Button>
        <Button size="sm" variant="ghost" onClick={() => setView(null)}>
          Dismiss
        </Button>
      </div>
    </div>
  );
}

Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.

Keep the active view value in the parent and match it to a DynamicIslandView ID. Leave essential task controls reachable when the compact state is shown.

Customization

DynamicIslandProps.view
Required; string | null. Active view id. `null` shows the compact pill.
DynamicIslandProps.compact
Optional; ReactNode. Compact pill content, shown when no view is active.
DynamicIslandProps.children
Optional; ReactNode. DynamicIslandView elements.
DynamicIslandProps.className
Optional; string.
DynamicIslandViewProps.id
Required; string. Matches the parent `view` prop when active.
DynamicIslandViewProps.children
Required; ReactNode.
DynamicIslandViewProps.className
Optional; string.
NumberTickerProps.value
Required; number.
NumberTickerProps.pad
Optional; number. Digits to pad to (left).
NumberTickerProps.duration
Optional; number. Per-digit roll duration in seconds.
NumberTickerProps.stagger
Optional; number. Stagger between digits.
NumberTickerProps.startOnView
Optional; boolean. Render only after the element enters the viewport.
NumberTickerProps.prefix
Optional; string.
NumberTickerProps.suffix
Optional; string.

Integration notes

  • An expanded state should not hide unreported errors from another task.
  • Check focus when changing views and avoid covering primary navigation on narrow screens.

Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.

Better with your agent

Give your agent taste.

The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.

All components are free. Sign up only to connect MCP.

Connect to MCP