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

Resizable#

Component <neo-resizable> is a wrapper that turns any content into a draggable box. The handles attribute picks which edges and corners get a drag handle; clamp the result with min-/max-width and min-/max-height, and snap to a pixel grid with step-horizontal and step-vertical. After the first drag the host owns size as inline styles. Double-click or double-tap a handle to reset its axis back to the natural size.

Default
Bottom-right corner
Edges only
All eight handles
Vertical only
Horizontal only
Step grid
Custom handle icon
Deactivate Rename Duplicate
Delete
New state Toggle autoplay
Drag the corner width is signal-editable
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
handlesstring observednoneSpace-separated list: top, bottom, left, right, top-left, top-right, bottom-left, bottom-right.
min-widthstring observednoneCSS length, mirrored to the inline min-width style. Omit for no minimum (none is invalid for min-*).
max-widthstring observednoneCSS length or none (no maximum), mirrored to the inline max-width style.
min-heightstring observednoneCSS length, mirrored to the inline min-height style. Omit for no minimum (none is invalid for min-*).
max-heightstring observednoneCSS length or none (no maximum), mirrored to the inline max-height style.
widthstring observednoneInitial width.
heightstring observednoneInitial height.
step-horizontalnumbernoneSnap width to a multiple of this many pixels while dragging. Omit for free resize.
step-verticalnumbernoneSnap height to a multiple of this many pixels while dragging. Omit for free resize.

States #

NameDescription
:state(resizing)Set while a handle drag is in flight.
:state(handle-<dir>)Set alongside resizing for the handle being dragged (handle-top, handle-bottom-left, …); the kit uses it to pick the resize cursor.

Slots #

NameDescription
defaultResizable content.
[data-neo-resizable-icon]Custom glyph per direction. The attribute value names the handle (e.g. bottom-right).

Events #

NameDetailBubblesDescription
neo-resizable-startnoneyesFires when a drag begins.
neo-resizable-resize{ width: number, height: number }yesFires on every frame during a drag.
neo-resizable-endnoneyesFires when the drag ends.

CSS variables #

NameDefaultDescription
--neo-resizable-handle-colorvar(--muted, currentColor)Handle color at rest.
--neo-resizable-handle-hover-colorvar(--page-fg, currentColor)Handle color on hover or during a drag.
--neo-resizable-handle-opacity0.55Handle opacity at rest.
--neo-resizable-handle-hover-opacity1Handle opacity on hover or during a drag.
--neo-resizable-handle-hover-bgcolor-mix(in srgb, var(--page-fg) 5%, transparent)Handle background on hover or during a drag.
--neo-resizable-edge-thickness0.5remHit-area thickness of the edge handles.
--neo-resizable-corner-size1remHit-area size of the corner handles.
--neo-resizable-icon-size0.85remHandle glyph size.

Examples#

Bottom-right corner#

The textarea pattern: a single corner handle for when the surrounding layout pins one edge and only the opposite corner should grow.

Drag the corner handles="bottom-right"

Edges only#

All four edge handles, no corners, so each axis moves independently and the cursor is always single-axis.

Pick an edge handles="top bottom left right"

All eight handles#

Every edge and corner. The corners (NW–SE / NE–SW cursors) sit above the edges so they win on overlap.

Drag any edge or corner full handle set

Vertical only#

A vertical sash. The layout fixes the host's width; only the bottom edge moves, so the cursor stays ns-resize.

Drag the bottom edge handles="bottom"

Horizontal only#

A horizontal sash, symmetric to the vertical case: only the right edge moves, cursor stays ew-resize.

Drag the right edge handles="right"

Step grid#

step-horizontal and step-vertical snap each axis to a multiple of their pixel value while dragging, so the box resizes one grid cell at a time instead of continuously. Drag the corner over the grid to see it jump.

Drag the corner step-horizontal="24" step-vertical="24"

Custom handle icon#

Drop a child marked data-neo-resizable-icon="<dir>" and the host reuses it instead of injecting the default grip. Only the glyph changes; the handle wrapper, positioning, and cursor stay host-owned.

Custom corner glyph data-neo-resizable-icon override

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator