Island Morph, animated React component
A black pill that morphs between a timer, an incoming call and a full music player, with each state's content blurring in once the shape lands.
- Pro
- Motion Effects
- Spring
Whooshes softly when you press a state button, Accept or Decline. Sound is off on this site until you switch it on.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| autoplay | boolean | false | Cycles through idle, timer, call and music until a control is pressed. |
| stiffness | number | 380 | How firmly the pill springs to its next shape, 120 to 800. Higher is snappier. |
| damping | number | 30 | How quickly the pill settles, 10 to 60. Lower overshoots and wobbles, higher stops dead. |
| blur | number | 10 | How blurry the content is as it fades in and out, in px, 0 to 24. 0 is a plain fade. |
| contentDelay | number | 0.08 | Seconds the content waits for the shape to land before it appears, 0 to 0.6. |
| surface | string | "#000000" | Colour of the pill. Any CSS colour; keep it dark so the white content stays readable. |
| timerColor | string | "#ff9f0a" | Colour of the timer's clock icon and numbers. Any CSS colour. |
| enableSound | boolean | true | Plays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Island Morph is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
Island Morph questions
How do I install Island Morph?
Run `npx shadcn@latest add @nexus-labs/island-morph`. It installs framer-motion. Island Morph is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).
Which states does it have, and how do I switch them?
Four: idle, timer, call and music. The segmented control under the pill switches them, and in the call state Accept goes to timer and Decline to idle. `autoplay` (off by default) cycles them until a control is pressed.
Can I change the caller, song or timer?
Not through props; `autoplay` is the only behavior prop. The caller "Alex Rivera", the song "Night Drive" and the demo countdown are written in the file, so edit them there. The pill sizes per state live in the `SIZES` object.
How does the morph work?
One black element animates its width, height and border radius with a spring. Each state's content is swapped with AnimatePresence and blurs in a moment after the shape starts to move. It uses Framer Motion and no other library.
Which controls actually do something?
Accept and Decline move between states, and the Play and Pause button toggles the music animation. Previous and Next in the music state are visual only. The pill is a `role="status"` live region, so state changes are announced.
Does it make sound, and how do I turn it off?
Whooshes softly when you press a state button, Accept or Decline. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.