Skip to content

The accessible base

@sypnia/base: the behaviour every piece needs, with no look of its own.

Applies to EngineCloud
View as Markdown
On this page
  1. What it guarantees
  2. The pieces
  3. How your look attaches
  4. You never import it directly

Some things are hard to get right and should never look different from one app to the next: how the keyboard moves through a menu, where focus goes when a dialog closes, what a screen reader says about a switch. @sypnia/base does those things, and nothing else. It has no colours, no sizes, no fonts and no icons.

It is a React package, MIT-licensed, built on React Aria, the same engine Sypnia’s own library uses. Every customer shares it; no customer looks like another because of it.

What it guarantees

AreaWhat the base does
Focusa visible focus state only when people use the keyboard; focus moves to a dialog when it opens and back when it closes
Keyboardevery piece works with the keyboard alone: arrows in menus and tabs, Escape to close, Enter and Space to press
Screen readersthe right role, name and state on every piece; announcements for toasts and changes
Layersone manager for everything that floats (menus, popovers, dialogs, sheets, toasts): the right one is on top, Escape closes the top one, the page behind does not scroll
Dialogs and menusfocus kept inside while open, outside clicks handled, nested menus
Phone behaviourhit areas of at least 44 px; popovers become bottom sheets under 640 px; safe areas respected; the field you type in stays visible above the keyboard; nothing depends on hover
Languagesright-to-left layouts, dates and numbers in the person’s language

The pieces

Button, Link, TextField, NumberField, SearchField, Select, ComboBox, Checkbox, RadioGroup, Switch, Slider, Dialog, AlertDialog, Sheet, Popover, Menu, Tooltip, Tabs, Disclosure, Toast region, Table, GridList, Calendar, DatePicker, FileTrigger, DropZone, Toolbar, Breadcrumbs, Form, VisuallyHidden, SkipLink and Layer.

How your look attaches

The base exposes each state as a data attribute, so your styles are plain CSS:

src/design/components/Button.module.css (part)
.button { background: var(--espiga-color-accent); border-radius: var(--espiga-radius-control); }
.button[data-pressed] { transform: translateY(1px); }
.button[data-focus-visible] { outline: 2px solid var(--espiga-color-focus); outline-offset: 2px; }

States: data-pressed, data-hovered, data-focus-visible, data-open, data-selected, data-invalid, data-disabled.

You never import it directly

Screens import pieces from your own src/design/. design check reports a screen that imports @sypnia/base directly, because that piece would have no look and no place in your gallery.

  1. What it guarantees
  2. The pieces
  3. How your look attaches
  4. You never import it directly

    Search pages, sections and terms