Fragiola

Concepts

The primitive contract

What every part of every primitive accepts and guarantees - namespaces, render instead of asChild, refs, forwarded props, structural style only, no text.

Every primitive follows the same contract, in each framework's idiom.

One namespace per component

A component's parts are one namespace: Dialog.Root, Dialog.Trigger, Dialog.Popup, ... in React and Vue; in Angular, one standalone directive per part, [dialogRoot], [dialogTrigger], [dialogPopup], applied to your own elements.

render, never asChild

A part renders a default element (a button for a trigger, a div for a popup), and you can replace it:

render={<a href="/profile" />} merges the part's props into your element; render={(props, state) => ...} receives them with the part's state. className and style take a value or a function of the state.

Props, refs and handlers

  • ref is a plain prop in React 19; in Vue a template ref gives the part's element ($el); in Angular a template reference variable does.
  • Any other prop is forwarded to the element: id, aria-*, data-*, event handlers.
  • Handlers compose: the part's own handler runs first, then yours.

Controlled and uncontrolled

A value is controlled when you pass it (open, value) and uncontrolled otherwise (seeded by defaultOpen, defaultValue). Every change is reported with its reason: onOpenChange(open, { reason }) in React, v-model:open and @open-change in Vue, [(open)] and (openChangeDetails) in Angular. A controlled value you keep unchanged stays yours: a dialog whose open you keep true stays open and working.

An overlay's open change (Dialog, AlertDialog, Drawer, Popover, Tooltip, Menu, ContextMenu, Select, Combobox and the date pickers) carries an OpenChangeDetails, and is reported before the state changes:

memberwhat
reasonwhy it changes: trigger-press, escape-key, outside-press, ..., or imperative-action for a handle's or the actions' call
eventthe DOM event that caused it, undefined when it came from code
triggerthe trigger it is associated with (the pressed one, else the active one), if any
cancel(), isCanceledcancel the change: the overlay stays as it is, in both modes, and keeps working
preventUnmountOnClose()on a close: the popup stays mounted (data-ending-style) until the actions' unmount()

In Vue, @open-change comes first and update:open follows only when not canceled; in Angular, (openChangeDetails) first, then (openChange) only when not canceled. Value changes (onValueChange, onCheckedChange) carry { reason, event } and cannot be canceled.

Every overlay also reports the end of its transitions, onOpenChangeComplete(open) (@open-change-complete, (openChangeComplete)), and has two actions, close() and unmount(): React's actionsRef on the Root, the Vue Root's template ref, the Angular root directive's methods (#menu="menuRoot", menu.close()). Its Portal's keepMounted keeps the content in the page while closed, hidden and data-closed.

No text, structural style only

A primitive renders only your children: no text and no accessible name of its own. Its inline style is structural only (a position, a size, a CSS variable your styles read, like the tab indicator's --tabs-indicator-inline-size), never cosmetic.