Skip to content

Component Catalog ​

uni-ui is a set of ready-made components for RxElement apps on Scala.js: buttons, text fields, tabs, foldable side panes, splitters, overlays (popovers, tooltips, menus, dialogs, selects, and toasts), virtualized lists, trees, and tables, and a dock. The same components work in a browser and in an Electron app. See Setup to add the artifact and load uni-ui.css.

Components keep their behavior and their look apart. Scala code sets ARIA roles, focus, keyboard handling, data-state attributes, and a data-slot name on every part. uni-ui.css styles those with --uni-* CSS variables, so an app restyles a component by setting variables, not by changing Scala code.

To build a widget uni-ui doesn't have, start from the behaviors the components are made of: keyboard navigation, typeahead, selection, focus handling, and stick-to-bottom scrolling.

Conventions ​

Each component is an RxElement that takes the Rx values it reads. Options are withXXX methods. A component takes one parameter list of the arguments it cannot work without. Name the functions, triggers, and multi-value arguments at the call site, so each one says what it is (key = _.id, render = ..., trigger = ...). An argument that holds several values, such as menu entries or dialog content, is a Seq: entries = Seq(...). Pass extra attributes as modifiers, and use cls += so the component's own classes stay.

  • State you own. Components write user input into the RxVars you pass them, and onChange sees each such change first and can cancel it.
  • Accessible by default. Components set ARIA roles and keyboard handling following the WAI-ARIA Authoring Practices, mirror ArrowLeft and ArrowRight in right-to-left layouts, and pass checkPattern in uni-ui's own tests.
  • Readable by agents. UiAgent lets an AI agent read and operate the components on screen.

The components ​

PageComponents
ControlsButton, IconButton, Input, Textarea, TabList/TabPanel, Badge, Kbd
OverlaysPopover, Tooltip, Menu, ContextMenu, Dialog, AlertDialog, Select, Toaster
CollectionsVirtualList, Tree, DataTable, CommandPalette; multi-select and reordering
Layout & DockStack, Grid, GridItem, Separator, FoldablePane, Splitter, StatusBar, Dock

The gallery runs each of these components live, next to the code that renders it (how it works).

examples/uni-harness builds a full workspace shell with these components and Tailwind CSS.

Released under the Apache 2.0 License.