Skip to content

Developers

Getting started

Download DESIGN.md

Stingray is plain CSS, JavaScript and HTML, with no framework or build step.

Release
Stingray 1

Files

Files and their contents
FileContainsRawGzipped
tokens/tokens.cssAll tokens as custom properties: light, dark, density.
css/icons.cssThe MingCute subset as mask images.
css/stingray.cssComponents, type, layout helpers, print.
js/stingray.jsKeyboard models, charts, toasts, theme and density.
fonts/*.woff2Atkinson Hyperlegible Next, regular and semibold, latin and latin-ext. Latin-ext loads only when needed.
tokens/_tokens.scssThe tokens for Sass.
tokens/tokens.jsonThe token source, for tooling.

Sizes measured by the build on 28 Sep 2026. Copy these files into your project; there is no package yet.

DESIGN.md for AI assistants

Give this file to AI assistants that write Stingray UI. It lists every class, token, attribute and icon, the fixed rules, and how to record a departure.

Where to put the file
ToolPut it at
Claude CodeCLAUDE.md in the project root
Codex, Cursor, Zed and other agent toolsAGENTS.md in the project root
GitHub Copilot.github/copilot-instructions.md
A chat assistantAttach DESIGN.md

If the file already exists, add "Follow DESIGN.md for all UI" to it and keep DESIGN.md beside it.

Minimal page

Put class="sg" on <body>, not <html>. Load the script in the head.

Guidelines

Use

  • The documented markup: a class per part, a modifier per variant (sg-button, sg-button--primary, sg-table__sort).
  • Semantic or spacing tokens in your CSS: var(--sg-color-text-secondary).
  • data-sg-* attributes for behavior, and Stingray.init(root) for markup added later. It is safe to run twice.
  • lang on the page, for sorting and number formatting.
  • Decorative icons. Icon-only controls need aria-label and a tooltip (Iconography).

Avoid

  • Hex values or primitive color tokens.
  • !important or deep selectors on components. Add a token instead.

Theme and density

Set data-theme and data-density on any element; both nest. Without data-theme, the system preference applies.

Content Security Policy

Stingray needs no inline scripts, inline handlers or remote requests. It runs under this policy:

Icons need data: in img-src. Set dynamic values with el.style.setProperty('--sg-meter-value', '72%'), not a style attribute. Demos on this site use inline scripts and styles; do not copy them.

JavaScript API

The Stingray global
CallDoes
Stingray.init(root = document)Wires tabs, grids, filters, menus, comboboxes, date ranges, uploads, chips, trees and palettes inside root. Runs on load; call again after inserting markup.
Stingray.toast({ title, message, status, action, timeout })Shows a toast. Returns { dismiss }. Info and success dismiss after 8 seconds; warning and error stay. An action with undo: true also answers Ctrl+Z.
Stingray.chart(el, spec)Renders an SVG chart with legend, readout and table view. Returns { update, loading, setTexture, destroy }.
Stingray.spark(el, values)Draws a sparkline with no axes.
Stingray.theme, Stingray.densityget(), set(value), and for theme effective().
Stingray.hapticsget(), set(on), tap(). On by default; the choice is saved. Products put it in their settings.
Stingray.busy(button, work, { busy, done })Blocks the button until work settles, then shows the done label for 600ms. Resolves with the result.
Stingray.stagger(list)Brings in a list's first ten rows, 30ms apart. First load only.
Stingray.announce(message)Sends a message to the polite live region.

Attributes

Data attributes
AttributeOn
data-sg-gridA table: makes it a keyboard grid.
data-selectableThe grid: enables row selection.
data-sg-row, data-sg-select-allCheckboxes that drive selection.
data-sg-filter="#id"An input that filters that table.
data-sg-count-for, data-sg-selection-forElements that show counts, with a data-template.
data-sg-tabsThe container of a tab list and its panels.
data-sg-dialog-open="#id", data-sg-dialog-closeButtons that open and close a dialog or a drawer.
data-sg-dismissibleA dialog that closes on an outside click.
data-sg-tip="text", data-sg-tip-keyAny element that needs a tooltip, and its shortcut.
data-sg-changedA cell whose value just changed: tinted for a moment.
data-sg-comboboxA combobox.
data-sg-date-range, data-sg-rangeA date range and its preset buttons.
data-sg-upload, data-max-sizeA file upload and its size limit in bytes.
data-sg-bulk-for="#id", data-sg-clear-selection="#id"The bulk action bar of a grid, and its clear button.
data-sg-chips="#id", data-sg-chips-clearFilter chips, where focus goes after the last, and Clear all.
data-sg-treeA tree view.
data-sg-paletteA command palette dialog; Ctrl+K opens it.

Events

Custom events
EventDetail
sg:selectionchange{ count }
sg:activate{ row }: Enter on a grid row.
sg:sort{ column, direction }
sg:filter{ visible, total }
sg:menuselect{ item }
sg:change{ value, label, option }: a combobox pick.
sg:rangechange{ from, to }
sg:fileschange{ files }: the files kept.
sg:chipremove, sg:chipsclear{ value, label }, none
sg:treeselect, sg:treetoggle{ item, label }, { item, open }
sg:command{ option, value, label }: a palette pick.
sg:themechange, sg:densitychange{ theme }, { density }

Examples

Field with an error

Grid selection

Toast with Undo

Chart refresh

SCSS

Frameworks

In React, Vue or Angular, render the documented markup and call Stingray.init(container) after rendering. Do not reimplement the keyboard models; they expect the documented DOM.

Browser support

Chrome and Edge 120 or later, Firefox 121 or later, Safari 17 or later.

Platform features and fallbacks
FeatureUse forFallback
Popover APIMenus.A toggle with outside-click and Escape handling.
<dialog>, :focus-visible, mask, :is()Dialogs, focus, icons, selectors.None; baseline.
:has()Selected segment, disabled choice row.None; baseline.
Logical propertiesSpacing and sizing. Layouts and arrow icons mirror under dir="rtl".None; baseline.

Token build

Edit tokens/tokens.json and run the build. It regenerates the CSS, SCSS and site data, and fails with a list if a rule breaks.

Requires Node 18 or later (tested on 24) and nothing else. See Token architecture for the gates.