UI kit reference
This reference is generated from the UI kit definition and lists UI kit 1.0.0. Each element is a Preact component in @attricat/ui-kit; Attricat validates what your Worker renders and draws it with its own components. Anything not listed here is dropped.
Lays out its children in a row or a column with theme spacing.
Since: 1.0.0. Children: UI kit elements.
| Prop | Type | Description |
|---|---|---|
direction |
vertical | horizontal |
The main axis. (default "vertical") |
gap |
none | xs | sm | md | lg | xl |
Space between children. (default "md") |
align |
start | center | end | stretch |
Alignment across the main axis. (default "stretch") |
justify |
start | center | end | between |
Distribution along the main axis. (default "start") |
wrap |
boolean | Wraps a horizontal stack onto more lines. (default false) |
Places its children in equal columns that collapse to one on narrow screens.
Since: 1.0.0. Children: UI kit elements.
| Prop | Type | Description |
|---|---|---|
columns |
integer 1–6 | Columns on wide screens. (default 2) |
gap |
none | xs | sm | md | lg | xl |
Space between cells. (default "md") |
Divider
Section titled “Divider”A horizontal rule.
Since: 1.0.0. Children: none.
A paragraph of plain text, already localized by the extension.
Since: 1.0.0. Children: plain text.
| Prop | Type | Description |
|---|---|---|
tone |
default | muted | info | success | warning | error |
Text colour, by meaning. (default "default") |
size |
sm | md |
Text size. (default "md") |
emphasis |
regular | strong |
Font weight. (default "regular") |
monospace |
boolean | Uses the code font, e.g. for formulas. (default false) |
Heading
Section titled “Heading”A heading inside the outlet; the host owns the outlet title.
Since: 1.0.0. Children: plain text.
| Prop | Type | Description |
|---|---|---|
level |
integer 1–3 | Heading level within the outlet. (default 1) |
Button
Section titled “Button”A button with a text label.
Since: 1.0.0. Children: plain text.
Methods: focus().
| Prop | Type | Description |
|---|---|---|
variant |
primary | secondary | text |
Visual emphasis. (default "secondary") |
tone |
default | danger |
A danger button confirms a destructive step. (default "default") |
icon |
alert | calculator | check | clock | download | file | info | link | refresh | search | send | settings | sparkles | tag | wand |
A host icon. |
disabled |
boolean | Disables the button. (default false) |
loading |
boolean | Shows progress and disables the button. (default false) |
| Events | Payload | Description |
|---|---|---|
press |
{ } |
The button was activated. |
IconButton
Section titled “IconButton”A button showing only a host icon.
Since: 1.0.0. Children: none.
Required accessible name: label.
Methods: focus().
| Prop | Type | Description |
|---|---|---|
icon |
alert | calculator | check | clock | download | file | info | link | refresh | search | send | settings | sparkles | tag | wand |
A host icon. (required) |
label |
string ≤ 200 | The accessible name and tooltip. (required) |
tone |
default | danger |
Colour, by meaning. (default "default") |
disabled |
boolean | Disables the button. (default false) |
| Events | Payload | Description |
|---|---|---|
press |
{ } |
The button was activated. |
TextField
Section titled “TextField”A text input the host owns; it sends debounced changes.
Since: 1.0.0. Children: none.
Required accessible name: label.
Methods: focus().
| Prop | Type | Description |
|---|---|---|
label |
string ≤ 200 | The visible label, also its accessible name. (required) |
hideLabel |
boolean | Hides the label visually; it stays the accessible name. Use it inside an attribute editor, whose field already shows one. (default false) |
helperText |
string ≤ 400 | Help shown below the input. |
error |
string ≤ 400 | An error message; the input is marked invalid while it is set. |
disabled |
boolean | Disables the input. (default false) |
required |
boolean | Marks the input as required. (default false) |
value |
string ≤ 100000 | The current text. |
placeholder |
string ≤ 200 | Shown while the input is empty. |
readOnly |
boolean | Shows the value without allowing changes. (default false) |
multiline |
boolean | Accepts several lines. (default false) |
rows |
integer 1–12 | Visible lines of a multiline input. |
monospace |
boolean | Uses the code font. (default false) |
maxLength |
integer 1–100000 | The longest text the input accepts. |
suggestions |
string[] ≤ 20 | Complete values the host offers below the input; choosing one replaces the text. |
| Events | Payload | Description |
|---|---|---|
change |
{ value: string ≤ 100000 } |
The text changed, debounced. |
submit |
{ value: string ≤ 100000 } |
Enter was pressed in a single-line input. |
NumberField
Section titled “NumberField”A numeric input the host owns and parses.
Since: 1.0.0. Children: none.
Required accessible name: label.
Methods: focus().
| Prop | Type | Description |
|---|---|---|
label |
string ≤ 200 | The visible label, also its accessible name. (required) |
hideLabel |
boolean | Hides the label visually; it stays the accessible name. Use it inside an attribute editor, whose field already shows one. (default false) |
helperText |
string ≤ 400 | Help shown below the input. |
error |
string ≤ 400 | An error message; the input is marked invalid while it is set. |
disabled |
boolean | Disables the input. (default false) |
required |
boolean | Marks the input as required. (default false) |
value |
number | null | The current number, or null when empty. |
minimum |
number | The smallest accepted value. |
maximum |
number | The largest accepted value. |
step |
number | The arrow-key step. |
unit |
string ≤ 16 | A unit shown after the input. |
placeholder |
string ≤ 200 | Shown while the input is empty. |
readOnly |
boolean | Shows the value without allowing changes. (default false) |
| Events | Payload | Description |
|---|---|---|
change |
`{ value: number | null }` |
Select
Section titled “Select”A choice from options given as data.
Since: 1.0.0. Children: none.
Required accessible name: label.
Methods: focus().
| Prop | Type | Description |
|---|---|---|
label |
string ≤ 200 | The visible label, also its accessible name. (required) |
hideLabel |
boolean | Hides the label visually; it stays the accessible name. Use it inside an attribute editor, whose field already shows one. (default false) |
helperText |
string ≤ 400 | Help shown below the input. |
error |
string ≤ 400 | An error message; the input is marked invalid while it is set. |
disabled |
boolean | Disables the input. (default false) |
required |
boolean | Marks the input as required. (default false) |
value |
string | null | The chosen option value. |
options |
{ value, label, disabled }[] ≤ 500 | The options, in order. (required) |
placeholder |
string ≤ 200 | Shown while nothing is chosen. |
| Events | Payload | Description |
|---|---|---|
change |
`{ value: string | null }` |
Checkbox
Section titled “Checkbox”A labelled checkbox.
Since: 1.0.0. Children: none.
Required accessible name: label.
Methods: focus().
| Prop | Type | Description |
|---|---|---|
label |
string ≤ 200 | The visible label, also its accessible name. (required) |
helperText |
string ≤ 400 | Help shown below the input. |
disabled |
boolean | Disables the input. (default false) |
checked |
boolean | Whether it is checked. (default false) |
| Events | Payload | Description |
|---|---|---|
change |
{ checked: boolean } |
It was checked or cleared. |
Switch
Section titled “Switch”A labelled on/off switch that applies at once.
Since: 1.0.0. Children: none.
Required accessible name: label.
Methods: focus().
| Prop | Type | Description |
|---|---|---|
label |
string ≤ 200 | The visible label, also its accessible name. (required) |
helperText |
string ≤ 400 | Help shown below the input. |
disabled |
boolean | Disables the input. (default false) |
checked |
boolean | Whether it is on. (default false) |
| Events | Payload | Description |
|---|---|---|
change |
{ checked: boolean } |
It was switched. |
A short status label.
Since: 1.0.0. Children: plain text.
| Prop | Type | Description |
|---|---|---|
tone |
neutral | info | success | warning | error |
Colour, by meaning. (default "neutral") |
icon |
alert | calculator | check | clock | download | file | info | link | refresh | search | send | settings | sparkles | tag | wand |
A host icon. |
A link to an https: address, opened in a new tab, or to an Attricat page by its path.
Since: 1.0.0. Children: plain text.
Methods: focus().
| Prop | Type | Description |
|---|---|---|
href |
string ≤ 2048 | An https: URL or an in-app path starting with /. (required) |
Rows given as data; the host sorts, pages and virtualizes them.
Since: 1.0.0. Children: none.
Required accessible name: label.
| Prop | Type | Description |
|---|---|---|
label |
string ≤ 200 | The table’s accessible name. (required) |
columns |
{ key, label, align, sortable }[] ≤ 20 | The columns, in order. (required) |
rows |
{ id, cells }[] ≤ 1000 | The rows: an ID and a value per column key. (required) |
emptyText |
string ≤ 200 | Shown when there are no rows. |
| Events | Payload | Description |
|---|---|---|
rowPress |
{ id: string ≤ 200 } |
A row was activated. Rows are interactive only while a listener is set. |
EmptyState
Section titled “EmptyState”Explains why there is nothing to show, with an optional action.
Since: 1.0.0. Children: none.
Required accessible name: title.
| Prop | Type | Description |
|---|---|---|
title |
string ≤ 200 | The message. (required) |
description |
string ≤ 4000 | More detail. |
icon |
alert | calculator | check | clock | download | file | info | link | refresh | search | send | settings | sparkles | tag | wand |
A host icon. |
Slots:
action(Button): A button that resolves the empty state.
Host icons
Section titled “Host icons”alert, calculator, check, clock, download, file, info, link, refresh, search, send, settings, sparkles, tag, wand