FUNSTACK UI

HomeWhyGetting startedConceptsComponentsRoadmap
GitHub

FUNSTACK UI is in beta. Part of the FUNSTACK family with FUNSTACK Router and FUNSTACK Static, which build this site.

Introduction

  • Why FUNSTACK UI
  • Overview
  • Getting started

Concepts

  • Action props
  • Pending & optimistic state
  • Transitions & ViewTransition
  • Suspense
  • Browser-owned state
  • Server Components

Guides

  • Replacing the element (render)
  • Direction and locales
  • Experimental features
  • Next.js App Router
  • React Router framework mode
  • Content Security Policy
  • Using with AI agents

Components

  • Buttons
    • Button
    • Toggle
    • ToggleGroup
    • Toolbar
  • Disclosure
    • Tabs
    • Accordion
    • Collapsible
    • NavigationMenu
  • Overlays
    • Tooltip
    • HoverCard
    • Popover
    • Dialog
    • AlertDialog
    • Drawer
    • Menu
    • Context menu (Menu)
    • Menubar (Menu)
    • Toast
  • Forms
    • Field and Form
    • Checkbox
    • CheckboxGroup
    • RadioGroup
    • Switch
    • Select
    • Combobox
    • MultiSelect
    • Slider
    • NumberField
    • OTPField
    • TextField
  • Output
    • Progress
    • Meter
    • Avatar
  • Layout
    • Separator
    • Scroll areas (recipe)

Resources

  • Roadmap & changelog
  • GitHub ↗

Roadmap & changelog

FUNSTACK UI is in beta; releases are on npm. Planning happens in GitHub issues; this page is a short summary.

Stability

The current releases are betas (0.1.0-beta.N). A beta means the API is believed complete and has been tried by building apps with it, but nobody uses it in production yet.

  • Breaking changes are still allowed during the beta. Each one is listed in the release notes with a migration note.
  • There is no deprecation period: a breaking change takes effect in the release that announces it. Read the release notes before you upgrade.

An experimental_* prop is removed once its platform feature ships in every engine (see Experimental features). That removal is a breaking change too, and it is listed the same way.

Changelog

Betas are published on npm under the beta dist-tag. Until 1.0, each release also moves the latest dist-tag, so npm install @funstack/ui installs the newest release. Each release is listed on GitHub Releases; between releases, the commit history is the changelog.

Behaviour changes

Changes an upgrade may notice, newest first. Each component page documents the current behaviour.

  • details.reject() (#207): an action that catches its own error and calls it before it settles is treated as rejected (the optimistic value reverts, uncontrolled state is not written, a menu, toast or dialog stays open, an overlay keeps its open) without reaching an Error Boundary or reportError. Types: every action prop's details is now Details & Rejectable (ChangeAction included); the named details types are unchanged, and handlers have no reject. A rejecting Toast.Action reaches the boundary above the Action part, as it always did; the docs now say so (they said "above the Viewport") and recommend a boundary around the Action.
  • TextField in a textarea: Ctrl+Enter / Cmd+Enter commits, as a blur does, and is always prevented; it submits no form, and Enter is still a new line (#196). type="search" stays unsupported; the development warning now points to type="text" with role="searchbox" and enterKeyHint="search" (#197).
  • New component TextField (#181): a text field that saves itself. The typed text is a draft; blur or Enter commits it through valueCommitAction with data-pending, a refused save shows the saved text again, and Escape with an edited draft puts the saved text back. Transition types fsui-text-field*. type="search" is not supported in this version.
  • NumberField's Escape reverts an edited draft (#181): with typed text that differs from the value's, the first Escape now shows the value again and is consumed, so an enclosing Dialog or Popover stays open; the next Escape closes it. Before, the first Escape closed the layer and the draft was lost with it. With no edited draft nothing changes.
  • Escape on a Tooltip, HoverCard or toast is no longer lost to a stopPropagation() (#194). A handler that stops the Escape, a React onKeyDown anywhere around the focus included, used to leave a shown tooltip or card open, keep a toast, and let a tooltip's or card's coming open go ahead; they now close (or cancel) all the same, as a non-modal Dialog already did. Keep one open with preventDefault(). One order change: with focus in a toast and a tooltip or card showing elsewhere, the first Escape now closes the tooltip or card and the next one the toast (before, the toast went first).
  • A Close part (Dialog.Close, Popover.Close, Drawer.Close, AlertDialog.Cancel, AlertDialog.Action) without action now has data-pending and state.pending from the click until the close it asked for has committed, as one with action and a Menu.Item already did (#183): a Cancel clicked while the confirm runs shows the wait. A synchronous close shows it for one commit; delay a spinner in CSS. A Menu.Item without action no longer renders aria-disabled="true" while the menu's close waits.
  • Accordion and Collapsible tell their own open writes from the browser's by the value they last wrote or read (#175): a <details> re-opened by the browser while its close is pending is now dispatched with reason: "platform" instead of being taken for an echo.
  • New component Menubar (#170): a <div role="menubar"> around ordinary Menu.Roots. A Menu.Trigger inside it renders role="menuitem", and its disabled renders aria-disabled (it stays focusable); outside a bar nothing changes.
  • New component NavigationMenu (#170): a site's main navigation as the disclosure pattern, each panel a popover="auto" next to its popovertarget button. It needs no JavaScript by default; after hydration focus leaving a panel and a followed NavigationMenu.Link close it. A panel whose content loads on open opts into library mode (openChangeAction, transition types fsui-navigation-menu*). Hover opening and arrow keys are not in this version.
  • Direction and locale are decided (#172, #188): dir is the only direction switch and there is no provider; locale is a prop of each Root that formats. See Direction and locales. OTPField.Root now renders dir="ltr" unless you pass dir, so inside an RTL page its boxes no longer mirror. locale on Progress.Root and Meter.Root also takes a list of tags (string | readonly string[]), as on NumberField.
  • New component Drawer (#168): a Dialog attached to an edge (side, rendered as data-side) that the user can swipe back to it with mouse, pen or touch. The swipe writes data-swiping and --drawer-swipe-x / -y / -progress for your CSS, finishes the slide, and closes the drawer as a dismissal reported to onOpenChange. Its transition types are fsui-drawer*. Snap points and the pull from a scrolled-to-top list are not in this version.
  • New component OTPField (#171): a one-time-code field that is one autocomplete="one-time-code" input drawn as a row of boxes, with completeAction for the complete code, submitOnComplete and experimental_webOTP.
  • New component Avatar (#171), and a Scroll areas recipe page instead of a ScrollArea part.
  • A Dialog.Close or Popover.Close with an action no longer renders commandfor / command (#182). A click before hydration used to close the dialog or popover natively without running the action; it now does nothing until the page has hydrated, and then runs the action and closes. A Close without action is unchanged (a native invoker). Selectors on [command] no longer match such a button.
  • New component AlertDialog (#167): a Dialog with role="alertdialog", no light dismiss and focus on Cancel, whose Action runs an async action and closes when it resolves. Development messages of a Dialog part outside its Root now name the Root of its own namespace.
  • New component Separator (#169). Field.Control no longer throws outside a Field.Root: it renders the plain control and accepts id. A Slider's Track and Thumb and NumberField's Increment / Decrement no longer move or dispatch inside a <fieldset disabled> (#180); before, a drag or a press still changed the value although the browser had disabled the inputs.
  • New component MultiSelect (#165). <Select.Root multiple>, already a type error, no longer reaches the <select>: the attribute is dropped with a development warning that names MultiSelect. Field.Label focuses a button control (MultiSelect's Trigger) instead of clicking it.
  • A disabled Button whose click the browser acts on (type="submit" or "reset", the formAction default, commandfor / popoverTarget, with or without action) keeps native disabled also with a component or <input> render, as Form.Submit does; it used to render aria-disabled, which does not stop a submission or command before hydration (#158). Inside a Toolbar.Root or with focusableWhenDisabled nothing changes. A natively disabled Button, Dialog.Close, Popover.Close or Toast.Action that is also pending no longer adds aria-disabled: native disabled wins. A disabled JS-free Trigger or Close of a Dialog or Popover rendered as a host link renders aria-disabled instead of a meaningless disabled attribute, and its click is cancelled (the link no longer navigates after hydration).
  • Three alignments with the library-wide rules (#157):
    • Accordion in multiple mode passes valueChangeAction its open items in document order also when an Item mounted later (inserted between others, or behind a Suspense boundary); such an Item used to sort last. In exclusive mode, of several items opened before hydration the first in the document wins.
    • Toast.Action and Toast.Close render data-disabled when disabled, and on a link or component render aria-disabled="true" with a cancelled click (a disabled link no longer navigates); their state has a new disabled field. Form.Submit with a host element that is not a <button> or <input> (render={<a />}) renders aria-disabled with a cancelled click instead of a meaningless disabled attribute.
    • Form.Root passes the rejection of a submission that a later one superseded, or of one that settles after the form unmounted or was hidden, to reportError (a window error event) instead of dropping it. The latest submission's rejection still reaches the Error Boundary.
  • A popup with both a CSS exit and transition no longer needs the rule html:active-view-transition .my-popup { transition: none; } (#147; A popup with a CSS exit and a view transition). While a view transition runs, the library turns the popup's CSS transitions off for the moment of its own show or hide, with an inline transition: none !important that it removes right after. The rule is not needed: remove it. Keeping it breaks nothing, but an unrelated view transition of the page then still cuts a dismissal's CSS fade.
  • Breaking: requests and facts (#148; Requests and facts). On Popover.Root, Menu.Root, Combobox.Root and Dialog.Root:
    • openChangeAction is no longer called for a close the library did not perform on request: Escape, a click outside, focus leaving the popup, a parent menu closing its submenu, your own invoker button closing the popup, script hidePopover() / close(), and so on. These closes are facts, reported to the new onOpenChange instead. Code that checks reason === "dismiss" inside openChangeAction must move to onOpenChange.
    • A controlled Root needs onOpenChange as well: open={open} openChangeAction={setOpen} onOpenChange={setOpen}. Without it the popup re-opens after every dismissal (development warns); a Menu re-opened this way leaves focus where the dismissal put it (#155).
    • onOpenChange must set state directly, not in startTransition and not after an await.
    • A dismissal is no longer pending: no data-pending on the Trigger, state.pending stays false, the committed state is false at once, and the callback is not awaited.
    • A dismissal starts no view transition and carries no fsui-<component>-close type: transition on a Popup animates opens and the closes a part asks for; a dismissal is animated by CSS only.
    • A controlled Root that keeps open={true} after a dismissal is re-opened at once, not after the callback settled.
    • Errors: a failing dismissal callback no longer reaches an Error Boundary; a rejected promise returned from onOpenChange, or a throw, goes to reportError.
    • A dismissal during a pending close is reported at once; a request that was in flight is superseded (its rejection goes to reportError). Dialog.Root no longer holds such a dismissal back.
    • A Server Function passed to openChangeAction no longer hears dismissals; pass it to onOpenChange too.
    • JS-free mode (Popover, Dialog): onOpenChange on the Root selects library mode.
    Not changing: a popup opened before hydration is still a request, openChangeAction(true, { reason: "platform" }). Two closes keep reason: "dismiss" and stay requests to openChangeAction: the pointer leaving a hover-opened submenu, and lost interest while an interestfor open is still pending.
  • Breaking: toast({ closeAction }) is renamed onClose. It is called synchronously when the toast closes, is not awaited, no longer holds other transitions, and its rejection goes to reportError instead of the Error Boundary above the Viewport (#148).
  • Combobox.Root's onInputValueChange may return a promise: the development warning is gone, and a rejection or a throw goes to reportError. Every on* handler the library defines follows that rule (Action props, #148).
  • Breaking: a pending Button no longer ignores clicks or renders aria-disabled="true": every click, Enter or Space runs its action (or submits its function formAction) again. Add whilePending="ignore" to keep the old behaviour, for a Save, Pay or Delete that must not run twice. A Menu.Item with closeOnActivate={false} and a Toast.Action with closeOnSettle={false} now run every activation too. The Close parts, a closing Menu.Item and a closing Toast.Action still ignore a second activation by default; whilePending="run" opts out. In "run" mode the runs overlap, so an older run's rejection goes to reportError (#146).
  • An action that rejects after its component unmounted (a Toast.Action whose toast was closed meanwhile, a Menu.Item whose menu closed) or while it is hidden (an <Activity>, a closed keepMounted overlay, a Suspense boundary showing its fallback) is passed to the global reportError instead of being lost (#152).
  • Resetting the form of an uncontrolled CheckboxGroup while a change is pending lands on the default even when a pending change rejects later (#151).
  • When an older action rejects after a newer one started, the rejection no longer replaces the component with the Error Boundary: it is passed to the global reportError (a window error event) and the UI keeps the newer intent. The latest action's rejection still reaches the Error Boundary (#145).
  • Uncontrolled CheckboxGroup, and ToggleGroup and Accordion without exclusive, no longer commit a change whose action rejected when a later change's action resolved (#150).
  • Breaking (types): Combobox.Input owns onFocus, which is no longer in its props type; use onFocusCapture to react to focus (#132).
  • A Combobox.Trigger that is disabled but stays focusable (a component render with aria-disabled) is no invoker, like the other overlay Triggers: it renders aria-expanded and no popovertarget, and pressing it while the listbox is shown light-dismisses it (#132).
  • A Popover opened by an interestfor button that is not its Trigger (Chromium) hides when interest is lost, reported as "dismiss" (#127).
  • Pressing a button of yours that targets an open Menu or Combobox (a foreign invoker) no longer moves focus out of it first; the button's own close is the only close (#126).
  • A foreign popovertarget button that closes a Popover, Menu or Combobox is reported as "activate" instead of "dismiss" (#125).
  • Breaking: Popover.Trigger, Menu.Trigger, Menu.SubmenuTrigger and Combobox.Trigger name their popup with popovertarget instead of commandfor + command="toggle-popover", and a <button> Trigger renders no aria-expanded: every browser exposes the popup's state on it. Move CSS from [aria-expanded="true"] to [data-open] (now also written in Popover's JS-free mode), or to :has(+ :popover-open) on a page that never hydrates. A Trigger rendered as a link or another element through render keeps aria-expanded. Replace [commandfor] selectors on these Triggers with [data-open] or a class of your own. commandfor, command, popoverTarget and popoverTargetAction are owned by these Triggers (#121).
  • Clicking the Trigger of an open Menu or Combobox is a library-owned close on every engine: the popup stays shown with data-pending until openChangeAction(false) settles, and the exit view transition runs (#110, #112).
  • An overlay Trigger's aria-expanded and the Combobox input's report whether the popup is actually shown; data-open stays optimistic. With defaultOpen the server HTML has aria-expanded="false" until the popup is shown after hydration (#118).
  • A Trigger click on an open non-modal lightDismiss Dialog dismisses it on every engine (#116).
  • Popover and Menu Triggers rendered as something other than a <button> are no longer invokers; a development warning explains that they close through light dismiss (#115).
  • The fallback live region is removed: announcements use ariaNotify only (#113).
  • Combobox: a press on the input while the listbox is open no longer closes it (#123); pressing a label while typing no longer discards or commits the typed text (#111).
  • Toast: ArrowUp and ArrowDown inside a text field in a toast move the caret instead of switching toasts (#113).
  • Breaking: MenuTriggerProps no longer accepts onMouseDown (#110); ComboboxTriggerProps no longer accepts commandfor or command (#112); Combobox.Input owns onPointerDown (#123).
  • CheckboxGroup compares a controlled value by content, so an inline array with the same items does not re-render every Item (#108).
  • Slider and NumberField: when a newer action supersedes one that then rejects, the rejection reaches the Error Boundary at once instead of waiting for the action on the other channel (step or commit) to settle (#105).
  • Breaking: TabsValueChangeDetails.reason and AccordionValueChangeDetails.reason are the shared ChangeReason type (#102).
  • Breaking: Combobox.Root's inputValueChangeAction is renamed onInputValueChange and the type UrgentChangeAction is renamed UrgentChangeHandler; an action prop always means a transition (#96).
  • While a tooltip is showing, the next one opens at once (#21).
  • Breaking: data-side / data-align on Tooltip, Popover and Menu report the side the browser chose while shown, not the requested one; the side type gains "inline-start" / "inline-end" and align start / end mirror under RTL; a submenu opens on the inline-end side (the left in RTL) (#20, #53).
  • Every Menu closes on a right- or middle-click outside; a wheel over a menu never scrolls the page (#45, #88).
  • disabled on a link or component render renders aria-disabled="true" instead of native disabled on Toggle, ToggleGroup.Item, Menu.Trigger, Combobox.Trigger and Clear, NumberField.Increment and Decrement, and the Dialog and Popover Trigger and Close parts where they handle the click; a disabled link ToggleGroup.Item is reached by the arrow keys. Form.Submit keeps native disabled (#83; since #157 except on a host element that is not a <button> or <input>).
  • Dialog.Close, Popover.Close, Menu.Item and Toast.Action ignore a second click while their own action is pending, with aria-disabled meanwhile; before, a second click ran the action again (#81).
  • Breaking: Toolbar.Button is removed; use Button, which behaves the same inside a toolbar (#79).

Done

  • Library-wide API conventions: action props, pending and optimistic state, Suspense, ViewTransition, composition.
  • Toggle, Tabs, Accordion and Tooltip: the first four primitives.
  • Dialog, Switch, Checkbox and RadioGroup, with the shared form-reset and hydration handling.
  • Browser-mode tests (Playwright) in Chromium, Firefox and WebKit for Popover, anchor positioning, <dialog>, native inputs and ViewTransition.
  • A conditional <ViewTransition> boundary (#35).
  • The first npm release, 0.1.0-alpha.0 (dist-tag alpha).
  • CheckboxGroup (#33).
  • Popover (#38, #40).
  • Menu (#39, #41, #47).
  • Select and Combobox, the library's first urgent state, onInputValueChange (#50).
  • Toast, Slider and Field and Form (#54).
  • Progress and Meter, the first output-only components (#68).
  • ToggleGroup and Toolbar (#66).
  • NumberField (#67).
  • Button (#79), and re-entry handling for every pure trigger (#81, #83).
  • Context menu: Menu.ContextTrigger, press-drag-release, touch long-press and the library's first shipped (positioning-only) CSS (#45, #88). Touch is verified under Chromium's emulation; iOS and Android pending (#90).
  • Resolved placement (data-side is where the popup is), Tooltip.Arrow, logical sides and RTL (#20, #53, #88). Firefox misplaces anchored popups in a direction island (#89).
  • Tooltip skip-delay (#21).
  • Content Security Policy: STYLE_SHA256 and <CSPProvider nonce> (#88).
  • Variants of platform-native parts without "use client": considered and not built (#19); Server Components defines "JS-free" and the form-control pages show the plain HTML alternative.
  • Direction and locales: CSS direction is the one source, read per component at the event; a locale prop per Root, no provider (#172). Guide: Direction and locales.
  • TextField, a text field with a commit action (#181).

Next

  • More components toward a full set.

Deferred

  • An Accordion without "use client" (@funstack/ui/accordion/native): a ready plan, not scheduled (#19).

Upstream

  • react-dom renders hidden="until-found" as a boolean (#16).
  • Chromium does not match :checked on a checkbox that is both checked and indeterminate; jsdom toggles instead of restoring a checkbox after a cancelled click (#34).

Ideas and bug reports are welcome as new issues.