A wider screen, please

This page features interactive demos and side-by-side code samples that need at least 340 pixels of horizontal space. Please widen your browser window, or rotate your device, to continue.

Morpheus v0.1.0
v0.1.0

Tree#

Component <neo-tree> is a disclosure tree with collapsible subtrees. Click a row or press Enter / Space on a focused branch to toggle. Expand/collapse rides the kit's --neo-easing / --neo-duration-scale tokens, so each theme paces it on its own.

Default
File system
Single root, all collapsed
Deactivate Rename Duplicate
Delete
New state Toggle autoplay
src
App.tsx
main.tsx
package.json
HTML CSS

The selected state's markup and its scoped CSS. The CSS is wrapped in <style>@scope { ... }</style> and applies to the preview only. Edits change the preview above, applied live while Sync is on, or when you click Patch or Replace. Patch morphs the preview; Replace swaps it outright.

Replace Patch

Signals

Datastar signals declared in the selected state's markup. Change a value to drive the preview, applied live while Sync is on, or when you click Patch.

Patch

Reference#

Attributes #

NameTypeDefaultDescription
expandedboolean reflected observedfalseOn <neo-tree-item>: branch disclosure state.

Slots #

NameDescription
defaultNested <neo-tree-item> children inside <neo-tree>.
[data-neo-tree-label]Row content of a <neo-tree-item>.
[data-neo-tree-text]Label text inside [data-neo-tree-label]; fills the row and truncates with an ellipsis.
[data-neo-tree-actions]Trailing action controls inside [data-neo-tree-label]; pinned to the row's end and don't shrink.
slot="icon"Optional leading icon for a <neo-tree-item> row, projected before the label.

Events #

NameDetailBubblesDescription
neo-tree-item-toggle{ expanded: boolean, id: string, item: HTMLElement }yesFires when a branch expands or collapses.

Parts #

NameDescription
::part(row)Each item's row: the chevron plus the slotted label.
::part(children)Wrapper around a branch's nested items, animated open and closed.

CSS variables #

NameDefaultDescription
--neo-tree-row-paddingcalc(var(--page-spacing, 0.25rem) * 1.25) calc(var(--page-spacing, 0.25rem) * 2)Padding inside each row.
--neo-tree-row-gapcalc(var(--page-spacing, 0.25rem) * 2)Gap between the chevron, label, and actions in a row.
--neo-tree-indentcalc(var(--page-spacing, 0.25rem) * 5)Indentation added per nesting level.
--neo-tree-row-radiusvar(--page-radius, 0.25rem)Corner radius of a row's hover and focus background.
--neo-tree-row-hover-bgrgba(127, 127, 127, 0.12)Row background on hover.
--neo-tree-chevron-size0.85remChevron icon size.
--neo-tree-durationcalc(200ms * var(--neo-duration-scale, 1))Expand and collapse animation duration.

Examples#

File system#

The canonical shape: the first level and one nested branch start expanded, the rest collapsed. Click any branch to watch the disclosure animate.

src
components
Button.tsx
Card.tsx
Modal.tsx
hooks
useDebounce.ts
useMediaQuery.ts
App.tsx
main.tsx
public
favicon.svg
robots.txt
package.json
tsconfig.json

Categories (deep nesting)#

Six levels under one expanded root, with uniform per-level indentation. Click a collapsed inner branch to see the chevron rotate.

Animals
Mammals
Carnivores
Felidae
Lion
Tiger
Cheetah
Canidae
Wolf
Fox
Primates
Hominidae
Birds
Raptors
Songbirds

Single root, all collapsed#

Every branch starts closed, confirming the disclosure handle draws on the first row before any state is touched.

Documents
Invoices
2024-Q4.pdf
2025-Q1.pdf
Reports
Annual.docx

File explorer in a sidebar#

Compose rich rows from an icon, text, and trailing actions. Wrapped in a <neo-sidebar> so the actions hug the content edge at any width.

  • The folder / file icon is authored; the kit doesn't infer it.
  • [data-neo-tree-text] marks the row text so it consumes the available width.
  • [data-neo-tree-actions] pins trailing controls (here an inert eye button) to the tree's right edge.
Files
src
components
Button.tsx
Card.tsx
App.tsx
main.tsx
public
favicon.svg
package.json
tsconfig.json

Examples: Datastar#

Async loading (Datastar morph)#

Load branch children lazily on first open. Each unloaded branch renders a skeleton placeholder as its only child.

  • Opening a branch bubbles neo-tree-item-toggle to the root <neo-tree>, whose action posts the opened item's id.
  • The server patches that one <neo-tree-item> back with its real children.

Loading states only show with simulated delay. Raise network latency or handler delay in the Settings panel.

src
docs
tests

Bookmarks library#

Each leaf carries a star button that toggles a Datastar signal local to the button, with no server round-trip. The button's data-attr:data-neo-active binding flips the icon to the accent colour when the signal is true. The row layout is the same icon + text + actions split as the file-explorer demo above.

Reading
Frontend Trends 2025
CSS Container Queries
Modern TypeScript Patterns
Tools
Excalidraw
Linear
Notion
References
MDN Web Docs
TC39 Proposals

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator