Constellation Map
A calm, breathing network map for your product ecosystem — a root, hubs and leaves as chips joined by thin lines. Nodes drift slowly, can be dragged anywhere, highlight by branch and open small popovers.
Preview
Copy-paste React components, built on Tailwind and shadcn conventions.
- localhostui
- UI components — Copy-paste React components, built on Tailwind and shadcn conventions.
- Buttons & inputs — Accessible form primitives with every state covered.
- Cards & layouts — Bento grids, feature cards and section layouts.
- Navigation — Navbars, sidebars, command menus and tabs.
- Motion components — Animated text, marquees, 3D galleries and more.
- Data display — Tables, charts, stats and timelines.
- AI interfaces — Micro AI UI: components for building AI products.
- Chat & threads — Message lists, streaming text and markdown rendering.
- Prompt inputs — Composer with attachments, model picker and slash commands.
- Agent status — Tool-call steps, reasoning panels and progress states.
- Sources & citations (new) — Inline citations and source cards for RAG apps.
- Mobile components — React Native + Expo components that match the web set.
- Expo UI kit — Buttons, sheets, lists and inputs for React Native.
- Gestures & sheets — Swipe actions, bottom sheets and drag interactions.
- Ready screens — Auth, onboarding, profile and checkout screens.
- Skills for AI — Agent skills that teach AI coding tools to build with localhostui.
- UI design skill — Design rules, spacing and typography for agents.
- Mobile build skill — Expo patterns so AI writes production-ready RN screens.
- AI app skill — Patterns for chat, RAG and agent UIs.
- Component prompts (new) — Ready prompts to generate any component.
- Templates & blocks — Full pages and starters from the lokalhost.io marketplace.
- Landing pages — Conversion-focused marketing pages.
- Dashboards — Admin and SaaS dashboard starters.
- SaaS starters (pro) — Auth, billing and Supabase wired up.
- Ship faster — Install in seconds, own the code.
- CLI & registry — Install any component with one shadcn command.
- Themes & tokens — Swap colours, radius and fonts globally.
- Docs & examples — Live previews, props tables and usage notes.
- UI components — Copy-paste React components, built on Tailwind and shadcn conventions.
Installation
- 1
Run the following command
npx shadcn@latest add https://localhostui.com/r/constellation-map.json
The only runtime dependency is React — no d3, no physics or animation library. Requires Tailwind CSS v4 (it uses container queries and the starting: variant).
Fonts
The wordmark and popovers use your font-sans; hub and leaf chips use your font-mono. Both come from your Tailwind theme, so the map picks up whatever fonts the site already uses (Geist and Geist Mono here). Labels are re-measured once document.fonts.ready resolves, so a late-loading font never leaves a line ending in the wrong place.
Usage
import { ConstellationMap } from "@/components/lokalhost_io/creativity/constellation-map/constellation-map";
<ConstellationMap
data={data}
onNodeClick={(node) => track("map_click", { id: node.id })}
/>Data format
type MapData = {
root: { label: string; icon?: React.ReactNode; href?: string };
hubs: MapHub[];
links?: [string, string][]; // extra lines between any two node ids
};
type MapHub = {
id: string;
label: string;
description?: string;
href?: string;
angle?: number; // manual placement, degrees (0 = right, clockwise)
leaves: MapLeaf[];
};
type MapLeaf = {
id: string;
label: string;
description?: string;
href?: string;
badge?: "new" | "beta" | "pro";
};5–7 hubs with 2–6 leaves each read best — up to about 80 nodes in total. Ids must be unique across the whole map. Nodes with an href render as links; the rest are buttons. Pass your own logo as root.icon — the demos use the app icon (app/icon.svg, served at /icon.svg).
Examples
Dark, with parallax
Wrap the map in a dark element (or use your site's dark mode). parallax shifts the whole map a few pixels away from the cursor. Dragging works here too.
Copy-paste React components, built on Tailwind and shadcn conventions.
- localhostui
- UI components — Copy-paste React components, built on Tailwind and shadcn conventions.
- Buttons & inputs — Accessible form primitives with every state covered.
- Cards & layouts — Bento grids, feature cards and section layouts.
- Navigation — Navbars, sidebars, command menus and tabs.
- Motion components — Animated text, marquees, 3D galleries and more.
- Data display — Tables, charts, stats and timelines.
- AI interfaces — Micro AI UI: components for building AI products.
- Chat & threads — Message lists, streaming text and markdown rendering.
- Prompt inputs — Composer with attachments, model picker and slash commands.
- Agent status — Tool-call steps, reasoning panels and progress states.
- Sources & citations (new) — Inline citations and source cards for RAG apps.
- Mobile components — React Native + Expo components that match the web set.
- Expo UI kit — Buttons, sheets, lists and inputs for React Native.
- Gestures & sheets — Swipe actions, bottom sheets and drag interactions.
- Ready screens — Auth, onboarding, profile and checkout screens.
- Skills for AI — Agent skills that teach AI coding tools to build with localhostui.
- UI design skill — Design rules, spacing and typography for agents.
- Mobile build skill — Expo patterns so AI writes production-ready RN screens.
- AI app skill — Patterns for chat, RAG and agent UIs.
- Component prompts (new) — Ready prompts to generate any component.
- Templates & blocks — Full pages and starters from the lokalhost.io marketplace.
- Landing pages — Conversion-focused marketing pages.
- Dashboards — Admin and SaaS dashboard starters.
- SaaS starters (pro) — Auth, billing and Supabase wired up.
- Ship faster — Install in seconds, own the code.
- CLI & registry — Install any component with one shadcn command.
- Themes & tokens — Swap colours, radius and fonts globally.
- Docs & examples — Live previews, props tables and usage notes.
- UI components — Copy-paste React components, built on Tailwind and shadcn conventions.
Dragging
Dragging is on by default. Grab any chip — the root included — and drop it anywhere:
- The dropped node keeps its new position, and everything it would overlap eases out of the way.
- Dragging a hub brings its leaves along.
- Lines follow live while you drag.
- Dropped positions are remembered as fractions of the map, so they survive resizes.
<ConstellationMap data={data} /> // drag, stays where dropped
<ConstellationMap data={data} dragMode="spring" /> // drag, springs back home
<ConstellationMap data={data} draggable={false} /> // staticA drag never triggers a click, and links don't navigate after a drag. On touch screens, chips use touch-action: none so they can be dragged; swipe on empty space to scroll the page.
Custom popover
renderPopover replaces the card content. The card keeps its placement, hover bridge and dialog semantics.
<ConstellationMap
data={data}
renderPopover={(node) => (
<div className="space-y-2">
<p className="text-sm font-medium">{node.label}</p>
<p className="text-sm text-neutral-500">{node.description}</p>
{"leaves" in node && <p className="text-xs text-neutral-400">{node.leaves.length} items</p>}
</div>
)}
/>Manual hub placement
hubs: [
{ id: "ui", label: "UI components", angle: -90, leaves: [...] }, // top
{ id: "ai", label: "AI interfaces", angle: 0, leaves: [...] }, // right
]How it works
- Layout (
layout.ts, computed once per size). Hubs sit on an ellipse (34% × 36% of the container) starting at -100°. Each hub's leaves fan outward along the root → hub direction over ±(25° + 12° × count), at alternating edge-to-edge distances (≈58px and ≈92px) with seeded jitter. Then positions are scaled toward the centre until every label box fits, 30 passes of box repulsion push overlapping labels apart (the root never moves, hubs barely), and every box is clamped inside the padding. If overlaps remain, the radii shrink by 5% and it tries again. - Breathing (
motion.ts). Each node drifts around its home on a sum of two slow sines per axis (0.08–0.18 Hz, so one breath takes 6–12 s) with its own seeded phases: 2px for the root, 5px for hubs, 8px for leaves. The whole graph also scales 1 → 1.008 → 1 every 8 s. The drift never moves the layout itself. - Lines are recomputed every frame from the live positions. Each one is trimmed to the exact rounded border of both chips (a ray / rounded-rectangle intersection: straight edges or the corner circles), so it meets the chip cleanly instead of floating near it or crossing over the text.
- Hard bounds. After the offsets, every label box is clamped inside the padded container again — nothing is ever clipped.
- Stillness where you look. The hovered or dragged node and its direct neighbours ease to a standstill, so the text you're reading holds still.
- Smooth sub-pixel motion. Each chip is its own compositor layer (
will-change: transform) and moves withtranslate3dat sub-pixel precision. Slow drift glides instead of stepping a whole pixel at a time.
Theming
Colours are CSS variables on the wrapper, with dark-mode values built in. Override any of them with className or style:
| Variable | Light | Dark | Used for |
|---|---|---|---|
--cm-ink | #141413 | #ECEAE4 | Wordmark, hubs, popover title, accent |
--cm-muted | #5E5D59 | #9C9A92 | Leaves, descriptions |
--cm-line | #D9D6CE | #2A2925 | Lines, tree connector |
--cm-line-active | #A8A59C | #5C5A53 | Highlighted lines |
--cm-card | #FFFFFF | #1A1A18 | Chip and popover background |
--cm-card-border | #EEECE6 | #2A2925 | Chip and popover borders |
--cm-accent | --cm-ink (or accentColor) | Default icon, “new” badge, focus ring |
Everything is monochrome by default; pass accentColor only if you want a brand colour.
<ConstellationMap data={data} className="[--cm-line:#cbd5e1] [--cm-line-active:#64748b]" />The map background is transparent, so it sits on whatever page colour you use.
Responsive
| Width | Behaviour |
|---|---|
| ≥ 900px | Full radial map. |
| 600–899px | Same map with smaller type (hubs 12.5px, leaves 11px) and tighter leaf fans. |
| under 600px | A vertical tree: the root on top, hubs as an accordion, leaves as chips with their details inline. Same data, same content. Change it with mobileFallback. |
Breakpoints use container queries, so they follow the map's own width, not the window. On resize the layout re-runs (debounced 100ms) and nodes glide from their old positions to the new ones over 400ms.
Props
ConstellationMap
| Prop | Type | Default | Description |
|---|---|---|---|
data* | MapData | — | The root, its hubs and their leaves, plus optional cross links. |
height | number | string | "clamp(520px, 70vh, 820px)" | Height of the radial map. Numbers are px. For a percentage, also give the wrapper a height via className (e.g. "h-full"). |
padding | number | 48 | Minimum space between any label and the container edge, in px. Nothing is ever placed or drifts into it. |
accentColor | string | ink | Colour of the default root icon, “new” badges and focus rings. Monochrome (the ink colour) unless you set it. |
breathe | boolean | true | Slow organic drift around each node's home position, plus a gentle whole-graph breath. |
breatheIntensity | number | 1 | Multiplies the drift amplitudes (root 2px, hubs 5px, leaves 8px). |
parallax | boolean | false | Shift the whole map up to 6px away from the mouse cursor. |
draggable | boolean | true | Let people drag any node, the root included. Dragging a hub brings its leaves along. |
dragMode | "stay""spring" | "stay" | stay: a dropped node keeps its new position (remembered across resizes) and the rest makes room. spring: it springs back home. |
showCrossLinks | boolean | true | Draw the extra lines from data.links. |
MapHub
| Prop | Type | Default | Description |
|---|---|---|---|
id* | string | — | Unique across the whole map (used by links). |
label* | string | — | Shown as a mono chip. |
leaves* | MapLeaf[] | — | 2–6 work best. |
description | string | — | Popover text. |
href | string | — | Renders the hub as a link and adds “Learn more” to the popover. |
angle | number | — | Manual placement in degrees (0 = right, clockwise). By default hubs are spread evenly, starting at -100°. |
MapLeaf
| Prop | Type | Default | Description |
|---|---|---|---|
id* | string | — | Unique across the whole map. |
label* | string | — | Shown as a small grey mono chip. |
description | string | — | Popover text. |
href | string | — | Renders the leaf as a link and adds “Learn more” to the popover. |
badge | "new""beta""pro" | — | Small pill after the label. |
Interaction
| Input | Action |
|---|---|
| Hover / focus a hub | Highlights the hub, its leaves and their lines; everything else fades to 35%. The popover opens after 120ms. |
| Hover / focus a leaf | Highlights the leaf, its hub and the path to the root, then opens the popover. |
| Move onto the popover | It stays open — there is an invisible bridge and a 200ms grace period. |
| Click a node | Links navigate. Buttons pin their popover open; click again or outside to close. |
| Drag a node | Moves it (a hub brings its leaves). It stays where you drop it and the rest makes room; dragMode="spring" sends it back home. |
| Tap (touch) | First tap opens the popover, the “Learn more” link navigates, a tap outside closes it. |
Tab | Root → hub 1 → its leaves → hub 2 → … |
| Arrow keys | Move between siblings (hubs, or leaves of the same hub). |
Escape | Closes the popover and keeps focus on the node. |
Accessibility
- Every node is a real
<button>(or<a>when it has anhref) in a logical tab order, with a visible focus ring. Nodes with a popover exposearia-haspopup="dialog"andaria-expanded. - The popover is a non-modal
role="dialog"labelled by its title, placed right after its node in the DOM, soTabreaches the “Learn more” link next. - The SVG lines are
aria-hidden. A visually hidden nested list repeats the root → hub → leaf structure (with descriptions) for screen readers. - With
prefers-reduced-motion: no breathing, no parallax, no line drawing — the map simply fades in.
Performance
- One
requestAnimationFrameloop. It writestransformon each chip and the four coordinates on each line directly to the DOM — no React state changes per frame. - Label sizes are measured only on layout (mount, fonts loaded, resize) — never inside the loop.
- The loop stops when the map is off-screen (
IntersectionObserver), the tab is hidden, or nothing is moving (breathe={false}and no hover, drag or tween). - Comfortably 60fps with 80 nodes.
- SSR: the server renders a static home layout (in percentages, so it fits any width). The client measures, lays out and plays the entrance once the map scrolls into view — no hydration warnings and no layout jump. Without JavaScript the static map is still shown.