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

Elastic#

Component <neo-elastic> is a block container that animates its height as the natural size of its content changes: toggled visibility, added items, swapped blocks, async-loaded payloads. A ResizeObserver pins the latest content height to the host; the transition rides --neo-easing / --neo-duration-scale so each theme paces it differently. Server-side morphs that swap content animate the height shift automatically.

Default
Bigger content
Deactivate Rename Duplicate
Delete
New state Toggle autoplay

A plain block container that smoothly animates its height when the natural size of the content changes.

Switch between states to watch the host animate from one content height to the next.

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
openboolean observedtrueOpen by default. Set open="false" to animate the host to 0px tall.
reset-on-collapsebooleanfalseSwap content for [data-neo-async-placeholder] after the collapse transition.

Slots #

NameDescription
[data-neo-async-placeholder]Replacement content shown after collapse when reset-on-collapse is set.

Events #

NameDetailBubblesDescription
neo-elastic-start{ from: number, to: number }yesFires at the start of a height transition.
neo-elastic-end{ height: number }yesFires once the height transition lands.

Examples#

Toggle reveal#

The accordion case. While the inner is display: none the wrapper measures zero and the host collapses; on reveal it animates back to the natural content height. The button just flips the inner's hidden attribute; the host re-measures on its own.

Show details

Examples: Datastar#

Datastar morph patches that swap or re-render the inner content animate the height shift automatically; Elastic's ResizeObserver / MutationObserver re-pin on every reflow, so any server-driven content swap reads as a smooth transition without per-demo wiring.

Morphing during interaction#

A Datastar fat-morph can grow or shrink the content inside a <neo-elastic> mid-view. The host stays mounted across each morph and animates from the old height to the new one, no per-demo wiring. Autoplay cycles the states below to simulate the morphs.

Initial
Taller content
Shorter content
Deactivate Rename Duplicate
Delete
New state Toggle autoplay

Release notes

The server just morphed this card in place.

  • Elastic re-measures on every morph.
  • The host animates to the new height.
  • The element stays mounted, so no reflow flash.
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

Growing list#

A Datastar morph patch replaces the inner <ul> with a fresh count of items. The wrapper re-measures on every replacement and the host transitions between the old and new heights.

+ Items: 2
  • First item
  • Second item

Content swap#

Not just expand-from-zero: the host shrinks or grows between two differently sized blocks. Whatever the wrapper measures, the host transitions to. Re-toggling mid-flight retargets the latest height instead of finishing the old one.

Verbose

Short summary: one sentence and out.

The same container animates between wildly different content sizes.

  • Each toggle reads the new natural height.
  • Mid-animation interrupts retarget the latest height.
  • Resizing the viewport reflows; ResizeObserver re-pins.

Async placeholder#

Combine reset-on-collapse with a <template data-neo-async-placeholder> to reload content through the placeholder. Opening reveals the skeleton and posts to the server, which morphs the loaded panel into the slot; collapsing reinstates the skeleton after the transition, so the next open loads fresh. Closing aborts an in-flight request. Load details, collapse, then reopen.

Load details

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator