UI

Morph select

A trigger surface that morphs smoothly into an option list or a multi-input card.

import { MorphSelect } from '@uthereal/ui/morph-select'

Morph select playground

Region
Loading interactive preview…

Overview

MorphSelect is one continuous surface. Its compact trigger expands into an option list or a structured multi-input card without shifting surrounding layout. While open, the card continuously morphs its width and height when search filters options, collapsible sections toggle, conditional fields appear, or custom child inputs change size.

Use MorphSelect for single-value property pickers, compact filter popovers, and multi-field configuration cards. Use Multiselect when users need inline removable chips and free-text autocomplete directly inside a form field. Use Radio when all choices should remain visible on the page.

Usage

'use client'
import { MorphSelect } from '@uthereal/ui/morph-select'

export function RegionPicker() {
  return (
    <MorphSelect
      label="Region"
      defaultValue="eu-west"
      items={[
        { value: 'us-east', label: 'US East', meta: '12 ms', icon: 'globe' },
        { value: 'eu-west', label: 'EU West', meta: '28 ms', icon: 'globe' },
        { value: 'ap-south', label: 'AP South', meta: '94 ms', icon: 'globe' },
      ]}
      onValueChange={(value) => console.log(value)}
    />
  )
}

Pass items for Option List mode, sections for a serializable Multi-Input Card, or children / renderCard for arbitrary React inputs. In Option List mode, onValueChange reports the selected value and option object. In Card mode, onValuesChange and onApply report the field value map.

Examples

Pass flat or grouped items. When searchable is "auto", a search bar replaces the trigger lid automatically above eight options. Choosing an option lifts its label out of the list into the trigger while the trigger springs to its new width.

Timezone
Release channel

Structured multi-input card

Pass sections to host multiple input kinds inside one morphing card. Fields and sections accept a when predicate so toggling a switch or picking an option reveals new inputs and morphs the card smoothly. Set commitMode="apply" to stage edits until the user clicks Apply.

Deployment filters
Filter deployments
Trip search
Stay preferencesChanges update results live.

Composable React children

Place any React inputs inside MorphSelect via children or renderCard. A microtask-batched ResizeObserver measures content changes and morphs the card dimensions automatically. Nested overlays such as date pickers or popovers inherit LayerContext, so interacting with them never closes the card.

'use client'
import { useState } from 'react'
import { MorphSelect } from '@uthereal/ui/morph-select'

export function CustomFilterCard() {
  const [query, setQuery] = useState('')
  const [urgentOnly, setUrgentOnly] = useState(false)

  return (
    <MorphSelect
      label="Filters"
      icon="filter"
      cardTitle="Filter issues"
      summary={urgentOnly ? 'Urgent only' : query || 'All issues'}
    >
      {({ close }) => (
        <div style={{ display: 'grid', gap: 10 }}>
          <input
            type="text"
            value={query}
            placeholder="Search keyword"
            onChange={(event) => setQuery(event.target.value)}
          />
          <label style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
            <input
              type="checkbox"
              checked={urgentOnly}
              onChange={(event) => setUrgentOnly(event.target.checked)}
            />
            Urgent only
          </label>
          <button type="button" onClick={() => close(true)}>
            Done
          </button>
        </div>
      )}
    </MorphSelect>
  )
}

Polymorphic modes

ModeActivated byRole & focus modelBest for
Option listitemscombobox trigger with listbox and aria-activedescendantCompact single-value pickers with groups, icons, meta, and type-ahead
Structured cardsectionsdialog card; focuses first focusable field on openAI-generated or schema-driven multi-input filter and booking cards
Composable childrenchildren or renderCarddialog card wrapped in LayerContextHosting arbitrary @uthereal/ui inputs and custom interactive layouts

Supported structured field kinds

KindValue typeKey options
choicestring | nulloptions, display ("list" | "pills"), searchable
multi-choicestring[]options, display ("list" | "pills"), maxSelected
togglebooleanlabel, description, defaultValue
textstringplaceholder, multiline, maxLength
numbernumber | nullmin, max, step, unit
rangenumber | [number, number]min, max, step, unit (tuple enables dual thumbs)
datestring (ISO YYYY-MM-DD)min, max, localized trigger summary
tagsstring[]placeholder, maxTags, Enter/comma to add, Backspace to remove
colorstring (hex)swatches, defaultValue
dividernoneVisual separator with optional when predicate

API reference

These serializable arguments and defaults come directly from the component schema.

ArgumentType / defaultDescription
labelstringDefault: "Select"Visible label and accessible name. Name the information asked for, in sentence case.
hideLabelbooleanDefault: falseHide the label visually when the context already names the field. It is still announced.
descriptionstring—Supporting text below the field, announced with it. Use it for format hints and constraints.
errorstring—Validation message from your application. Setting it marks the field invalid; the message is linked to the field and announced politely.
requiredbooleanDefault: falseMarks the field as required for assistive technology and shows an indicator. Your application validates the value.
disabledbooleanDefault: falseUnavailable and removed from the tab order. A disabled field is not submitted with a form.
namestring—Native form field name, submitted with the value in a form.
itemsMorphSelectItem[]—Flat or grouped options for Option List mode (matches Arc morph-select). Unique values, optional icons, meta, descriptions, and search keywords.
sectionsMorphCardSection[]—Structured multi-input sections for Card mode. Supports choice, multi-choice, toggle, text, number, range, date, tags, color, and divider fields with optional conditional visibility (`when`).
defaultValuestring | nullDefault: nullInitial selected option value in Option List mode. Use value and onValueChange for controlled state.
defaultValuesRecord<string, MorphFieldValue>—Initial field-value overrides keyed by field id in Multi-Input Card mode.
placeholderstringDefault: "Select"Example text while the field is empty. Never a substitute for the label.
summarystring—Explicit closed-trigger summary text. Useful when rendering custom React children.
summaryTemplatestring—Template interpolating committed card values into the closed trigger, e.g. "{guests} guests · {region}".
showActiveCountboolean—Show a rolling badge pill on the trigger counting fields that differ from defaults (defaults true in Card mode).
iconplus | minus | x | check | pencil | trash-2 | copy | download | upload | share-2 | external-link | link | refresh-cw | rotate-ccw | search | filter | settings | ellipsis | ellipsis-vertical | eye | eye-off | lock | log-out | send | square | paperclip | mic | star | chevron-down | chevron-up | chevron-left | chevron-right | chevrons-up-down | arrow-left | arrow-right | arrow-up | arrow-down | menu | panel-left | maximize-2 | minimize-2 | file | file-text | folder | image | table | book-open | globe | calendar | code | message-square | sparkles | bot | user | brain | wrench | terminal | thumbs-up | thumbs-down | list-checks | info | circle-check | triangle-alert | circle-x | circle-help | clock | circle | circle-dashed | bell | loader-circle | mail | phone | chevrons-down-up | pipette | hash | bookmark | headphones | video | presentation | archive | circle-alert | sun | moon | monitor | command | folder-open | play | pause | file-image | file-play | file-archive | message-circle | check-check | circle-dot | smile-plus | corner-down-right | rotate-cw | file-code-corner | copy-plus | pin | git-pull-request | git-merge | git-pull-request-closed | file-diff | sun-moon | user-round | credit-card | calendar-days | signal-high | camera | image-plus | heart | bell-off—Optional curated leading icon displayed on the closed trigger.
cardTitlestring—Header title that crossfades into the morphing lid when open in Card mode.
cardSubtitlestring—Optional secondary copy shown beside cardTitle inside the open lid.
commitModelive | applyDefault: "live"live updates values immediately; apply stages edits inside the card and renders a Reset / Cancel / Apply footer.
searchableboolean | 'auto'Default: "auto"Show search in the open lid in Option List mode; "auto" enables search above 8 options.
searchPlaceholderstring—Placeholder inside the open search input.
panelWidthnumber | 'auto'Default: "auto"Expanded surface width in px, or "auto" (272px in Option mode; content-fitted in Card mode). Never narrower than the trigger.
maxHeightintegerDefault: 320Maximum scrollable body height in px before internal vertical scrolling starts.
alignstart | center | endDefault: "start"Horizontal edge of the trigger that stays stationary while the surface morphs.
sideauto | bottom | topDefault: "auto"Preferred vertical expansion side; auto flips upward when space below is limited.
portalbooleanDefault: falseRender the expanded surface in a ThemedPortal to escape overflow-hidden ancestors.
applyActionstring—Host action reported when Apply commits card edits.
resetActionstring—Host action reported when Reset restores card defaults.
labelsMorphSelectLabelsDefault: {"apply":"Apply","cancel":"Cancel","reset":"Reset","search":"Search {label}","clearSearch":"Clear search","close":"Close {label}","noMatches":"No matches for \"{query}\"","resultsCount":"{count} options","singleResult":"1 option","activeCount":"{count} active","applied":"Changes applied","resetDone":"Filters reset"}Accessible and UI labels for buttons, search, and announcements.
variantoutline | soft | ghostDefault: "outline"Field surface: outline for forms, soft on busy surfaces, ghost for inline editing without a border.
sizesm | md | lgDefault: "md"Field height and text size: 32, 36, or 46 pixels. Matches the button and dropdown trigger of the same size.
localestring—BCP 47 locale for formatting summary numbers and dates; inherits UtherealProvider when omitted.
recipestudio | softDefault: "studio"Visual treatment; both recipes keep identical morph physics.
themeMorphSelectTheme—Color mode, accent, and design tokens including closedRadius and openRadius.
motionnone | subtle | expressiveDefault: "subtle"Morph, highlight, and label animation preset. System reduced motion takes precedence.
motionOptionsMorphSelectMotionOptions—Override morph, resize, glide, and fly transitions (durations in milliseconds).
dirltr | rtl—Reading direction; mirrors alignment and RTL geometry. Inherited when omitted.

React integration

PropPurpose
value, onValueChange(value, option)Control the chosen option in Option List mode.
values, onValuesChange(values)Control the field value map in Structured Card mode.
onApply(values), onReset()Receive Apply commits and Reset actions in Card mode.
open, onOpenChange(open)Control whether the morphing surface is expanded.
onAction(action)Handle applyAction and resetAction in your application.
children, renderCard(ctx)Render custom inputs inside the morphing card.
renderTrigger(ctx)Replace the closed trigger content while keeping morph sizing.
renderHeader(ctx), renderFooter(ctx)Replace the open card header or footer in Card mode.
renderIcon(name, ctx)Render a custom icon for trigger, option, or section slots.
portalContainerExplicit portal target when portal is enabled.
ref, preset, tokens, className, styleStandard Uthereal root element and theming hooks.

Keyboard & accessibility

KeyOption list modeMulti-input card mode
Enter, SpaceOpen list, or commit the active optionOpen card (when focused on trigger)
ArrowDown, ArrowUpMove highlight by one option (Alt+ArrowUp commits)ArrowDown on trigger opens card
PageDown, PageUpMove highlight by 8 optionsNative control navigation
Home, EndJump to first or last enabled optionNative control navigation
Printable charactersOpen and filter (when searchable) or type-ahead jumpNative input entry
Tab, Shift+TabClose list and move focus to the next controlMove sequentially across nested inputs
Cmd+Enter, Ctrl+EnterIgnoredApply staged changes when commitMode="apply"
EscapeClose list and restore focus to triggerClose active nested layer first, then discard draft and restore focus

A pre-mounted polite role="status" region announces option selections, search match counts, apply confirmations, and resets. Setting error links the message with aria-describedby and renders it as role="alert". Nested overlays opened inside the card receive a dedicated unclipped portal host via LayerContext, preventing premature outside-click dismissal. All spacing and alignment use logical CSS properties for right-to-left layouts, and @media (forced-colors: active) preserves borders and active selection contrast.

Motion and theming

Opening expands the trigger surface on a physical morph spring with slight bounce (morph). Live content resizes while open and closing folds use zero-bounce smooth springs (resize) so narrowing never overshoots or truncates labels. In Option List mode, the option highlight glides on pointer hover and snaps immediately on keyboard navigation, while the chosen label flies from its list row into the trigger slot.

Setting motion="none" makes all geometry and text updates immediate. Under prefers-reduced-motion: reduce, geometry snaps immediately with no blur or label flight while keeping a 120ms opacity crossfade.

theme accepts color mode, accent, global core/control/popupList/selectionControl tokens, plus closedRadius (defaults to a full pill) and openRadius (defaults to 22px).

Composition

In an agent composition, MorphSelect can act as a leaf (using items or sections) or as a container holding up to 24 allowed input and layout children. Selected state binds to fields.<id>.value (Option List mode) and fields.<id>.values (Card mode).

{
  "type": "MorphSelect",
  "props": {
    "label": "Deployment filters",
    "icon": "filter",
    "cardTitle": "Filter deployments",
    "commitMode": "apply",
    "summaryTemplate": "{env} · {window}",
    "sections": [
      {
        "id": "scope",
        "title": "Scope",
        "fields": [
          {
            "kind": "choice",
            "id": "env",
            "label": "Environment",
            "display": "pills",
            "defaultValue": "prod",
            "options": [
              { "value": "prod", "label": "Production" },
              { "value": "staging", "label": "Staging" },
              { "value": "preview", "label": "Preview" }
            ]
          },
          {
            "kind": "toggle",
            "id": "onlyFailed",
            "label": "Only failed runs",
            "defaultValue": false
          },
          {
            "kind": "range",
            "id": "retries",
            "label": "Minimum retries",
            "min": 1,
            "max": 10,
            "defaultValue": 2,
            "when": { "field": "onlyFailed", "equals": true }
          }
        ]
      }
    ]
  },
  "children": []
}

On this page