Device controls

For running things on a vessel or a buoy: start and stop machinery, switch things on and off, and act only on a deliberate hold.

CommandSwitch

State and action in one control: the knob is what the device is doing, the other half what pressing will do. It waits on the device, can ask first, and says when something failed.

Running

Generator: stop asks first

Stopped

Fails the first time, to show it

Stopping…

Waiting on the device

Stopped

Primary tone

Fault

Overheat: 92 °C

Thrusters on

Local control on the vessel

Stopped

Disabled

Running

Small

<CommandSwitch
	on={generator.running}
	onCommand={(next) => api.generator(next)}
	confirm="stop"
	icon="bolt"
	label="Generator"
	description="Generator 2: 4,1 kW"
/>

ToggleButton

On or off, for what's safe to switch at once. The lamp lights while it's on; a spinner while the device switches.

<ToggleButton bind:pressed={lights} icon="lightbulb" onPressedChange={(on) => api.lights(on)}>
	Deck lights
</ToggleButton>

HoldButton

Press and hold until the fill reaches the end. Let go early and nothing happens. Space or Enter held works too.

Hold to confirm
Hold to stop everything
Hold to confirm
<HoldButton tone="primary" icon="vial" onConfirm={() => api.fire(4)}>
	Fire bottle 4
</HoldButton>

Timed runs

Pass endsAt (and runtime, for the bar) when a device runs for a set time: a bilge pump's 3 minutes. The knob counts down in place of its word, and a bar along its foot runs out.

Stopped

SlotGrid

A sampler's slots as the distributor holds them: odd over even. Each shows its number, a short line and its state; the picked one has a solid ring. A slot with a rack of inserts shows a bar per insert, and SubslotPicker under it picks which one.

<SlotGrid {slots} bind:selected={slot} bind:subslot={insert} onSelect={(n) => unit.setSlot(n)} />
<SubslotPicker of={slots.find((s) => s.n === slot)} bind:selected={insert} />

Rules

  • The device is the truth. Show what it reports, not what was asked, and wait for it to confirm.
  • Say the state and the action apart: "Running" and "Stop", never one word that could be either.
  • Every command can be slow or fail. Show that it’s waiting, and say so when it didn’t go through.
  • Ask before stopping machinery (CommandSwitch `confirm`); hold for what can’t be undone (HoldButton).
  • Safe, instant things are ToggleButtons: lights, a camera. Machinery is a CommandSwitch.
  • When the device is under local control, show the state read-only and say why.

All of them together, on a vessel with its water sampler: vessel controls example.