For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
Shadcn Labs/

Dynamic Island

A pill that springs between sizes as its state changes. A React component built on View Transitions, installed with the shadcn CLI.

Installation

$ pnpm dlx shadcn@latest add @transition-kit/dynamic-island

Usage

import {
  DynamicIsland,
  DynamicIslandContent,
  useDynamicIsland,
} from "@/components/transitions/dynamic-island";
const [state, setState] = React.useState("idle");
 
<DynamicIsland state={state} onStateChange={setState}>
  <DynamicIslandContent state="idle" className="w-32 px-4 py-3">
    Recording
  </DynamicIslandContent>
  <DynamicIslandContent state="timer" className="w-44 px-4 py-2.5">
    04:59
  </DynamicIslandContent>
</DynamicIsland>;
const DeclineButton = () => {
  const { setState } = useDynamicIsland();
  return (
    <button type="button" onClick={() => setState("idle")}>
      Decline
    </button>
  );
};

API Reference

DynamicIsland

PropTypeDefaultDescription
statestring-Controlled island state.
defaultStatestring"idle"Initial state when uncontrolled.
onStateChange(state: string) => void-Called with the new state when it changes.

DynamicIslandContent

PropTypeDefaultDescription
statestring-Only the content matching the shown state renders.

useDynamicIsland

ReturnTypeDescription
statestringThe current island state.
setState(state: string) => voidAnimates to the state and calls onStateChange.