Slab

A button drawn as a ring, for the action a view is about. One per view is the way forward; the others are quiet.

Part of a window with the heading Restart to finish updating, one line of text, a forward Slab Restart now and a quiet Slab Later.

Use a Slab for the action a panel or a view exists for: "Restart now", "Open", "Delete". For the other actions in a list, use actions as words. For a symbol without words, use an icon button.

Anatomy

A Slab has a ring and a word. It has no fill at rest. The tone changes the ring and the word, never the shape. The three tones are called forward, quiet and risk on this page. In code, forward is tone: "default", quiet is tone: "" and risk is tone: "risk".

Three Slabs at 1.8 times their size: forward, quiet and risk, with numbered callouts on the ring, the word and the warning symbol.
The three tones at 1.8 times their size.
  1. RingA pill, drawn as a line. Forward: 1.5 pixels in the accent at 75 %. Quiet: 1 pixel in the main ink at 42 %. Risk: 1 pixel in the risk ink at 55 %.
  2. WordWhat the action does, as a verb. Forward: medium weight, in the main ink. Quiet: regular, in the secondary ink, and the main ink under the pointer. Risk: regular, in the risk ink.
  3. Warning symbolOnly on a risk Slab, before its word, in the risk ink. A risk is never told by colour alone.

States

A state changes the fill or the size a little, never the ring or the words. The keyboard ring is the one addition. The values are on States.

Three Slabs, forward, quiet and risk, in four columns: at rest, under the pointer, pressed and with the keyboard focus ring.
Each tone in each state.
  1. RestNo fill.
  2. Pointer over itA faint fill of the main ink. The quiet word turns to the main ink.
  3. PressedThe Slab shrinks a little and returns when released.
  4. Keyboard focusThe ring, around the pill.
  5. Waitingwaiting: true is a Slab that cannot be pressed now, because its job is running: the ring in the quiet ink, the word in the secondary ink, no response and no stop for Tab. A screen reader hears it as disabled.

Confirming in place

Set confirm on a Slab whose action cannot be undone, and the Slab asks for itself. The first press does not act: the words become the question, in the risk tone with the warning symbol and a faint risk fill, whatever the tone was, and the Slab grows to fit them where it is anchored. The second press says picked().

A risk Slab twice. 1: at rest, Empty trash. 2: after one press, Delete 12 files for good, a little wider, with a faint risk fill.
At rest, then asking.

It goes back to its words, and says confirmCancelled(), when Esc is pressed, when the keyboard leaves it, when a pointer that pressed it leaves, or when 4 seconds (motion.confirmWait) pass untouched. A screen reader hears the question as the Slab's name. With reduced motion the words change at once. See Asking.

Sizes

A forward slab, 40 high with 26 pixels each side of the word, and a quiet slab, 36 high with 18 pixels each side, at 1.5 times their size.
A forward and a quiet Slab at 1.5 times their size.
PartValue
Forward height40 (height.action)
Quiet and risk height36 (height.field)
Forward widthThe word and 26 each side, at least 104
Quiet and risk widthThe word and 18 each side
Word15 pixels (row)
Warning symbol15 pixels, 7 before the word
CornerHalf the height, a full pill
LargeForward 50 high, at least 190 wide, 36 each side, its word 17 pixels; quiet 44 high, 26 each side, the symbol 17

A quiet Slab keeps the forward Slab's height in its box and draws its ring at 36, so rings of both kinds sit on one centre line when they stand side by side. Use the large size for a first-run page or a page with one thing to do, where the Slab is the one thing to press.

Keys and pointer

Do thisTo
TabMove the focus to the Slab
Enter or SpacePick it; with confirm, ask first, then pick
EscWhile asking, go back to the words
ClickPick it
HoverShow the fill; the pointer is a hand

Accessibility

Writing

Say what the action does: "Restart now", "Delete", "Open". Not "OK", not "Yes". The quiet word that leaves things as they are is "Cancel" or "Later". Keep each to one or two words.

Do and don't

A view titled Update ready with a quiet Later and a forward Restart now.
DoOne forward Slab in a view, with quiet ones beside it.
A view titled Update ready with two forward Slabs, Later and Restart now.
Don'tMake two Slabs forward. When both are the way forward, none is.
A view titled Trash: 12 files with a quiet Restore all and a risk Empty trash with the warning symbol, last.
DoPut the risk last, with the warning symbol.
A view titled Trash: 12 files with a quiet Restore all and a button filled solid in the risk colour.
Don'tFill a destructive button with colour. The kit has no filled button: a ring says "you can" and the symbol says "take care".

Code

import Tacit.Kit

Row {
    spacing: 12
    Slab { text: "Later"; onActivated: page.dismiss() }
    Slab { text: "Restart now"; tone: "default"; large: true; onActivated: system.restart() }
}
PropertyWhat it does
textThe word
tone"default": the way forward. "risk": the warning symbol and the risk ink. "": quiet
largeThe large size: 50 and 44 high
waitingThe job is running: a ring in the quiet ink that does not respond
maxWidthCaps the width (0 is no cap); the word is cut short in the middle
confirmThe question for what cannot be undone: the first press shows it, the second picks
activated()Sent by a click, Enter or Space; with confirm, by the second press
confirmCancelled()The question was left unanswered: Esc, the keyboard or pointer left, or 4 seconds

Experimental, in Tacit.Kit 0.1.