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
Morpheus Frameworks Settings

Frameworks#

Morpheus is framework-agnostic: its components are standard custom elements that render as plain DOM nodes anywhere. Pass state as attributes, put slotted content between the tags, and subscribe to Morpheus custom events. The same contract works in React, Vue, Svelte, Solid, server-rendered HTML, or plain vanilla JavaScript.

The simplest way to use Morpheus is to load the bundle once and write the elements directly in your framework's templates, the same as any other HTML.

Morpheus components are designed to be driven by changes to the DOM in a declarative way, and hence don't provide an imperative API surface. Control them through attributes and observe state changes through events. For example:

  • Turn a <neo-switch> on by setting its checked attribute, and react to the user toggling it by listening for the neo-switch-change event.
  • Show a toast by rendering a <neo-toast duration="4000"> inside the <neo-toaster>; it animates in and auto-dismisses after 4 seconds. It emits a neo-toast-close event when the user clicks its close button.

Datastar (Signals)#

The following example utilizes Reactive Datastar signals drives the components straight from HTML attributes, with no build step and no component wrapper. The example below is an accent-color picker held in two local signals; the _ prefix keeps them client-only, never serialized to a backend. A data-on:* listener reads the kit's events and data-attr:* bindings push the values back, so the <neo-select>, the <neo-color-field>, and the readout stay in sync.

Accent color

Red Green Blue Custom

Datastar (server-driven)#

Morpheus targets server-driven UIs just as well. This is the same picker, but no display state lives in the browser: the <neo-select> and <neo-color-field> post their change, and the server resolves the named-vs-custom logic and morphs the whole picker back. The Server script tab holds the handler. This page fakes the backend with an in-browser simulator, but the contract (action out, element morph back) is exactly what a real Datastar endpoint emits.

Accent color

Red Green Blue Custom

HTMX#

The HTMX implementation should be very similar to the server-driven Datastar example.

React#

The following example is powered by React 19.2.7 One piece of React state keeps the <neo-select>, the <neo-color-field>, and the hex <neo-textinput> in sync.

Alpine.js#

Alpine.js v3.x.x binds in the markup: x-data holds the color, the option, and the named-vs-custom logic; :value pushes that state onto each element and @event listeners feed the kit's events back. No build step and no component wrapper: the two-way binding falls out of the declarative bindings.

Accent color

Red Green Blue Custom

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator