Controls

Morph Island

A pill that grows into a panel, in the same body.

Preview

Installation

Terminal
npx @usefluid/cli add morph-island

Usage

MorphIsland.tsx
import { MorphIsland } from "./MorphIsland";

<MorphIsland label="Quick add" width={300} height={170}>
  <form>...</form>
</MorphIsland>

API reference

PropTypeDefaultDescription
labelstring—The pill's text and the button's name.
childrenReactNode—The panel's content.
width, heightnumber300, 170Open size in px.
closedWidthnumber150Closed size in px.
open, onOpenChange—Control it from outside, or leave it alone.
closeLabelstring"Close"

Keyboard and screen readers

Esc closes it and gives focus back to the pill.

Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

Width and height are two springs with the same damping, so the pill grows as one body. The content comes in after 120 ms, once there is room for it. Focus moves into the panel on open and back to the pill on close, and Esc closes it.

For your agent

For your agent

Add Morph Island to my project with the Fluid library. Use MorphIsland for the main quick action, with the content that makes sense in my product. Read my project first. Use my logo, my colours and my font through the --fluid-* variables. Keep 44px touch targets, visible focus and reduced motion. If I have no SVG logo, ask before making one up.