Skip to content
UniAria
Color scheme
Contrast
Color scheme
Contrast
A select, open0 re-renders
<button data-element="Trigger" + role="combobox" + aria-haspopup="listbox" + aria-expanded="true" + aria-controls="region-list" + data-open + data-focus-visible > Tokyo </button>
You write the markup. UniAria writes the + lines and keeps them current, without rendering your component.

Accessible UI.
Written once.
Zero re-renders.

The headless behavior layer under your design system. Keyboard, focus, ARIA and state for React, Vue and plain HTML, from one definition. Interaction goes straight to the DOM, and an AI agent operates your interface in one call.
0re-renders

while you hover, press or Tab through 1,000 React buttons. React Aria renders 400 to 601 times.

1,032accessibility scenarios

each run in React, Vue and custom elements, in Chromium, Firefox and WebKit, on every push.

2tool calls

for an AI agent to change a project’s settings. With browser tools: 17, at five times the cost.

20behaviors

from Button to Combobox, for React, Vue and plain HTML, plus the building blocks to write your own.

Use it. Then hand it to an agent.

A settings card in the default styles. Try it with the mouse or the keyboard: the tabs, the select and the number field follow their WAI-ARIA patterns, arrow keys and typeahead included.

Then press Run it. The agent sends one act() call with five steps. Each step runs through the same code your clicks run, so validation, form values and change events behave as they do for you. The switch it needs sits in a closed tab: the agent doesn’t have to know that, because the bridge opens the tab on its way.

A settings card, and an agent's task
View source
<!doctype html><meta charset="utf-8"><style>/* The page's layout. The components' look is @uniaria/styles' default. */
:root {
  font:
    15px/1.5 system-ui,
    sans-serif;
}
body {
  margin: 1.5rem;
  background: var(--uni-surface-color);
  color: var(--uni-text-color);
}
h2 {
  margin: 0;
  font-size: 1rem;
}
.demo {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 1rem;
  align-items: start;
}
@media (width < 46rem) {
  body {
    margin: 1rem;
  }
  .demo {
    grid-template-columns: minmax(0, 1fr);
  }
}
.card {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  border: var(--uni-border-width) solid var(--uni-border-color);
  border-radius: calc(var(--uni-radius) * 2);
}
/* Only the panel shown: a hidden one keeps `hidden`. */
[data-element='Panel']:not([hidden]) {
  display: grid;
  gap: 1rem;
  padding-block-start: 1rem;
}
.pair {
  display: grid;
  grid-template-columns: 1fr 9rem;
  gap: 1rem;
  align-items: end;
}
.actions,
.head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.head {
  justify-content: space-between;
}
.soft {
  color: var(--uni-text-soft-color);
  font-size: var(--uni-font-size-small);
}
pre {
  margin: 0;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  border: var(--uni-border-width) solid var(--uni-border-color);
  border-radius: var(--uni-radius);
  background: var(--uni-surface-hover-color);
  font-size: 0.75rem;
  line-height: 1.6;
}
.log {
  display: grid;
  gap: 0.25rem;
  min-block-size: 10.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font:
    0.8125rem/1.6 ui-monospace,
    monospace;
}
.log:empty::before {
  content: 'Press Run it to watch the agent work.';
  color: var(--uni-text-soft-color);
  font-family: system-ui, sans-serif;
}
.log li::before {
  content: '→ ';
  color: var(--uni-text-soft-color);
}
.log [data-kind='opened'] {
  color: var(--uni-accent-text-color);
}
.log [data-kind='opened']::after {
  content: '  (a closed tab: the bridge opens it)';
  color: var(--uni-text-soft-color);
}
.log [data-kind='note'] {
  color: var(--uni-text-soft-color);
}
.log [data-kind='done'] {
  color: var(--uni-accent-text-color);
  font-weight: 600;
}
.log [data-kind='failed'] {
  color: var(--uni-danger-text-color);
}
</style><div class="demo">
  <form id="settings" class="card" aria-labelledby="settings-title">
    <h2 id="settings-title">Project settings</h2>
    <uni-tabs default-value="general">
      <div data-uni="tabs">
        <div data-element="List" aria-label="Settings">
          <button data-element="Tab" data-key="general">General</button>
          <button data-element="Tab" data-key="notifications">
            Notifications
          </button>
        </div>
        <div data-element="Panel" data-key="general">
          <uni-text-field>
            <div data-uni="text-field">
              <label data-element="Label">Project name</label>
              <div data-element="Wrapper">
                <input data-element="Input" name="name" value="Atlas" />
              </div>
            </div>
          </uni-text-field>
          <div class="pair">
            <uni-select id="region">
              <div data-uni="select">
                <span data-element="Label">Region</span>
                <button data-element="Trigger">
                  <span data-element="Value"></span>
                </button>
                <div data-element="Popover">
                  <div data-element="List">
                    <div data-element="Option" data-key="fra">Frankfurt</div>
                    <div data-element="Option" data-key="iad">Virginia</div>
                    <div data-element="Option" data-key="nrt">Tokyo</div>
                    <div data-element="Option" data-key="gru">São Paulo</div>
                  </div>
                </div>
                <select data-element="HiddenSelect" name="region"></select>
              </div>
            </uni-select>
            <uni-number-field min-value="1" max-value="50" default-value="5">
              <div data-uni="number-field">
                <label data-element="Label">Seats</label>
                <div data-element="Wrapper">
                  <button data-element="Decrement">−</button>
                  <input data-element="Input" />
                  <button data-element="Increment">+</button>
                </div>
                <input type="hidden" data-element="HiddenInput" name="seats" />
              </div>
            </uni-number-field>
          </div>
        </div>
        <div data-element="Panel" data-key="notifications">
          <uni-switch>
            <label data-uni="switch">
              <span data-element="Label">Weekly digest</span>
              <input data-element="Input" type="checkbox" name="digest" />
              <span data-element="Indicator">
                <span data-element="Thumb"></span>
              </span>
            </label>
          </uni-switch>
          <uni-switch>
            <label data-uni="switch">
              <span data-element="Label">Mentions</span>
              <input
                data-element="Input"
                type="checkbox"
                name="mentions"
                checked
              />
              <span data-element="Indicator">
                <span data-element="Thumb"></span>
              </span>
            </label>
          </uni-switch>
        </div>
      </div>
    </uni-tabs>
    <div class="actions">
      <uni-button type="submit">
        <button data-uni="button" data-variant="primary">Save</button>
      </uni-button>
      <output id="saved" class="soft">Not saved yet.</output>
    </div>
  </form>

  <section class="card agent" aria-labelledby="agent-title">
    <div class="head">
      <h2 id="agent-title">An agent's task</h2>
      <uni-button>
        <button data-uni="button" id="run">Run it</button>
      </uni-button>
    </div>
    <pre><code id="steps"></code></pre>
    <ol id="log" class="log" aria-live="polite"></ol>
  </section>
</div>
<script src="/demo/home.js"></script><script>// The page's demo bundle (`apps/docs/demo/home.ts`) exports the agent bridge.
const { createAgent } = window.UniAriaDemo;

// The task an agent would send: one act() call with five steps.
const steps = [
  { ref: 'Project name', action: 'setValue', args: ['Orbit'] },
  { ref: 'Region', action: 'setValue', args: ['Tokyo'] },
  { ref: 'Seats', action: 'setValue', args: [12] },
  { ref: 'Weekly digest', action: 'setChecked', args: [true] },
  { ref: 'Save', action: 'press' },
];

const form = document.getElementById('settings');
const saved = document.getElementById('saved');
const run = document.getElementById('run');
const log = document.getElementById('log');

document.getElementById('region').defaultValue = ['fra'];

const quote = (value) => JSON.stringify(value).replaceAll('"', "'");
const call = ({ action, args = [] }) =>
  `${action}(${args.map(quote).join(', ')})`;

document.getElementById('steps').textContent = [
  'await agent.act({',
  '  steps: [',
  ...steps.map(
    ({ ref, action, args }) =>
      `    { ref: ${quote(ref)}, action: ${quote(action)}${
        args ? `, args: [${args.map(quote).join(', ')}]` : ''
      } },`,
  ),
  '  ],',
  '});',
].join('\n');

const entry = (text, kind) => {
  const item = Object.assign(document.createElement('li'), {
    textContent: text,
  });
  if (kind) item.dataset.kind = kind;
  log.append(item);
};

form.addEventListener('submit', (event) => {
  event.preventDefault();
  const data = Object.fromEntries(new FormData(form));
  saved.textContent = `Saved: ${Object.entries(data)
    .map(([name, value]) => `${name}=${value}`)
    .join(', ')}`;
});

// The bridge asks `allow` before every step, and before every tab it opens
// on the way. Here it only waits, so you can watch each change land.
let next = 0;
const agent = createAgent({
  allow: async (step) => {
    // The bridge passes the step resolved (an option's key for its label),
    // so the log shows the step as written, and a tab it opens as it is.
    const own = step.label === steps[next]?.ref ? steps[next++] : undefined;
    const text = `${step.label}: ${call(own ?? step)}`;
    // It looks behind a closed tab before it opens it for the step: one line.
    if (!own && log.lastElementChild?.textContent === text) return true;
    entry(text, own ? undefined : 'opened');
    await new Promise((resolve) => setTimeout(resolve, 650));
    return true;
  },
});
// Puts the card back between runs, without the pauses.
const reset = createAgent();

run.addEventListener('click', async () => {
  const button = run.closest('uni-button');
  button.isDisabled = true;
  log.replaceChildren();
  form.reset();
  saved.textContent = 'Not saved yet.';
  await reset.act({
    steps: [{ ref: 'Settings', action: 'setValue', args: ['General'] }],
  });
  const read = agent.snapshot().filter((c) => c.ref.startsWith('c'));
  entry(`snapshot(): ${read.length} components, as data`, 'note');
  next = 0;
  const result = await agent.act({ steps });
  entry(
    result.ok
      ? `ok: one call, ${steps.length} steps`
      : `failed at step ${result.error.step}: ${result.error.message}`,
    result.ok ? 'done' : 'failed',
  );
  button.isDisabled = false;
});
</script>

One definition. Every framework.

A component’s behavior is written once, in plain TypeScript: its keyboard, focus, ARIA and state. React, Vue and custom elements are thin adapters over that one definition, so a Select is the same Select in all three, and a fix lands in all three at once.

React

import { useSelect } from '@uniaria/react/select';

const regions = [
  { id: 'fra', name: 'Frankfurt' },
  { id: 'iad', name: 'Virginia' },
  { id: 'nrt', name: 'Tokyo' },
];

export function RegionSelect() {
  const region = useSelect({
    items: regions,
    getKey: (item) => item.id,
    getTextValue: (item) => item.name,
  });
  return (
    <div {...region.parts.root}>
      <span {...region.parts.label}>Region</span>
      <button {...region.parts.trigger}>
        <span {...region.parts.value} />
      </button>
      <div {...region.parts.popover}>
        <div {...region.parts.list}>
          {regions.map((item) => (
            <div key={item.id} {...region.getItemProps('option', item.id)}>
              {item.name}
            </div>
          ))}
        </div>
      </div>
      <select {...region.parts.hiddenSelect} name="region" />
    </div>
  );
}

Vue

<script setup lang="ts">
import { useSelect } from '@uniaria/vue/select';

const regions = [
  { id: 'fra', name: 'Frankfurt' },
  { id: 'iad', name: 'Virginia' },
  { id: 'nrt', name: 'Tokyo' },
];

const region = useSelect({
  items: regions,
  getKey: (item) => item.id,
  getTextValue: (item) => item.name,
});
</script>

<template>
  <div v-bind="region.parts.root">
    <span v-bind="region.parts.label">Region</span>
    <button v-bind="region.parts.trigger">
      <span v-bind="region.parts.value" />
    </button>
    <div v-bind="region.parts.popover">
      <div v-bind="region.parts.list">
        <div
          v-for="item in regions"
          :key="item.id"
          v-bind="region.getItemProps('option', item.id)"
        >
          {{ item.name }}
        </div>
      </div>
    </div>
    <select v-bind="region.parts.hiddenSelect" name="region" />
  </div>
</template>

HTML

<script type="module">
  import '@uniaria/elements/select';
</script>

<uni-select>
  <div data-uni="select">
    <span data-element="Label">Region</span>
    <button data-element="Trigger">
      <span data-element="Value"></span>
    </button>
    <div data-element="Popover">
      <div data-element="List">
        <div data-element="Option" data-key="fra">Frankfurt</div>
        <div data-element="Option" data-key="iad">Virginia</div>
        <div data-element="Option" data-key="nrt">Tokyo</div>
      </div>
    </div>
    <select data-element="HiddenSelect" name="region"></select>
  </div>
</uni-select>

The custom element works in any framework, or none, and reads its options from your markup.

You render the elements and own every class. UniAria writes the roles, aria-* attributes, ids, the keyboard and every data-* state, and keeps them current: the list opens in the browser’s top layer, so nothing is portaled or moved, and the hidden <select> submits the value with your form.

State goes to the DOM, not through your renders

In most libraries, hover, press, focus and a highlighted option are framework state, so each one renders your component again. UniAria writes them straight to the elements. A component renders again only for the state it reads:

import { useSelectState } from '@uniaria/react/select';

// Renders again when the selection changes, and for nothing else:
// opening the list, moving through it, hover and focus render nothing.
const selected = useSelectState(region, (state) => state.value[0]);

The difference shows in long lists, in pages with many components, and in design-system components whose render is expensive. A thousand buttons in React, against React Aria’s:

React Aria UniAria
Renders, hovering 200 buttons 400 0
Renders, clicking 100 buttons 598 0
Renders, pressing Tab 200 times 601 0
Script time, hovering 200 buttons 98.0 ms 32.9 ms
Script time, clicking 100 buttons 79.8 ms 18.2 ms
Script time, pressing Tab 200 times 80.6 ms 9.9 ms
One button, gzip 11.9 kB 8.4 kB

Production builds in headless Chromium, medians of seven runs (the benchmark). A button that reads its hover state renders for it, as it should: 400 times. Reading state.

Style it from the DOM

Every part carries a marker and its state as attributes, so plain CSS styles it, with no class names to pass and no render props. Positions come as CSS variables:

CSS

[data-uni='select'] [data-element='Trigger'][data-focus-visible] {
  outline: 2px solid var(--focus);
}
[data-uni='select'] [data-element='Popover'] {
  min-width: var(--anchor-width);
  max-height: min(16rem, var(--available-height));
}
[data-uni='select'] [data-element='Option'][data-focused] {
  background: var(--hover);
}
[data-uni='select'] [data-element='Option'][data-selected] {
  font-weight: 600;
}

Tasty

import { tasty } from '@tenphi/tasty';

// Spread `region.parts.root` on it: the parts are its sub-elements.
const RegionSelectRoot = tasty({
  styles: {
    display: 'grid',
    gap: '.5x',
    Trigger: {
      border: { '': '1bw #border', open: '1bw #accent' },
    },
    Option: {
      fill: { '': '#clear', '@own(focused)': '#hover' },
      color: { '': '#text', '@own(selected)': '#accent' },
    },
  },
});

Or start from @uniaria/styles: a complete look for every component, in light, dark and high contrast, written against the same attributes. The demo above wears it.

Ready for agents. Both kinds.

Agents that operate your page

An agent driving a page through browser tools clicks and types one control at a time, and works out again how each widget opens, filters and chooses. The agent bridge gives it the components instead: snapshot() lists them as data, and act() runs a whole task in one call.

import { createAgent } from '@uniaria/core/agent';

const agent = createAgent({
  // Asked before every step: keep a person in charge of what matters.
  allow: (step) => (step.confirm ? confirmWithPerson(step.confirm) : true),
});

// Hand the model the three tools, then run each call it makes.
const tools = agent.tools;
const result = await agent[call.name](call.input);

On UI SDK’s agent benchmark, which asks an agent to change a project’s settings, the same task on the same screen took:

Browser tools Agent bridge
Tool calls 17 2
Text read 36.6k 4.6k
Time 22–29 s 8 s
Cost $0.116 $0.021

Sonnet through Claude Code, December 2026 (the benchmark). The bridge speaks UI SDK’s agent protocol, so an agent, a tool definition or a harness written for UI SDK drives a UniAria page unchanged. Agents.

Agents that write your code

@uniaria/core ships the docs of its version and the uniaria-build skill to your coding agents, through harnesspm:

npx -y @harnesspm/cli init

With only that skill and those docs, an agent built a settings form, a searchable select and a disclosure UniAria doesn’t ship. All 10 behavior tests passed, and the types checked (the evaluation).

Accessibility you can check

Every component follows its WAI-ARIA Authoring Practices pattern, on a native element wherever one exists. 1,032 conformance scenarios hold it there: each runs through React, Vue and the custom elements, in Chromium, Firefox and WebKit, with a virtual screen reader checking what is spoken, on every push. VoiceOver and NVDA run every night.

The same checks test your own widgets, built on UniAria or not:

import { checkPattern } from '@uniaria/testing/browser';

// Roles, states, names, id references, then the keyboard, the way a
// keyboard and screen-reader user meets it. Every problem in one error.
await checkPattern(document.querySelector('#formatting')!, 'toolbar');

How UniAria is tested.

Build what isn’t in the box

UniAria’s own components are definitions like this one, composed from the same building blocks: a collection, roving focus, selection, press. Yours get what they get: every framework, server rendering, no re-renders and the agent bridge.

import { createListCollection } from '@uniaria/core/collections';
import { createRovingFocus } from '@uniaria/core/dom';
import { defineBehavior, prop } from '@uniaria/core';

export const toolbar = defineBehavior({
  name: 'toolbar',
  parts: ['root'],
  itemParts: ['item'],
  props: {
    items: prop<readonly { key: string; label: string }[]>([]),
    label: prop<string | undefined>(undefined, { type: 'string' }),
  },
  setup(ctx) {
    const collection = ctx.memo(
      () => [ctx.props.items()] as const,
      (items) =>
        createListCollection(items, {
          getKey: (tool) => tool.key,
          getTextValue: (tool) => tool.label,
          isDisabled: () => false,
          getChildren: () => undefined,
        }),
    );
    // One Tab stop, arrow keys between the items, Home, End, right to left.
    const roving = createRovingFocus(ctx, {
      collection,
      element: (key) => ctx.itemElement('item', key) as HTMLElement | null,
      root: () => ctx.element('root') as Element | null,
    });
    return { roving };
  },
  expose: () => ({}),
  connect: ({ props }) => ({
    root: { attrs: { role: 'toolbar', 'aria-label': props.label() } },
  }),
  connectItem: ({ api }, _part, key) => api.roving.itemProps(key),
});

useBehavior(toolbar, props) in React or Vue, or <uni-toolbar> once defineElement(toolbar) registers it. Custom components.

Behaviors

UniAria isn’t a component library: it renders nothing. Each behavior is one definition that your React or Vue component, or a custom element, runs on markup you write.

Start

Read the introduction for the ideas behind UniAria, see how it compares with other libraries, or go straight to getting started.