Getting Started

A dialog or popover that grows out of its trigger.

A card becomes a detail view, a button becomes a menu, a pill becomes a panel. It's live DOM, every morph can be interrupted, and it dismisses with a swipe.

Installation#

Install the package from your command line.

pnpm add eclosion

Create an Eclosion#

Compose the parts. The content stays out of the page until its trigger opens it.

share.tsx
import { Eclosion } from "eclosion/react";

export function Share() {
	return (
		<Eclosion.Root>
			<Eclosion.Trigger>Share</Eclosion.Trigger>
			<Eclosion.Content>
				<Eclosion.Title>Share this</Eclosion.Title>
				<Eclosion.Close />
			</Eclosion.Content>
		</Eclosion.Root>
	);
}

Style it#

eclosion ships no CSS. Style the parts with your own classes, and the motion takes care of itself.

<Eclosion.Content className="w-60 rounded-2xl bg-white p-2 shadow-lg">
	{/* ... */}
</Eclosion.Content>

Every part has a data-state of closed, opening, open or closing to style against. Don't put a CSS transition on Eclosion.Content, as it fights the per-frame updates.