Hooks
For components, useValues and overlays.
Input
| Hook | What it does |
|---|---|
usePress(onPress, { onLongPress, onDoublePress }) | Handles presses of the button's key, sensor or dial |
useHold(onStart, onEnd) | One thing while held, another when let go. Gives held and error. |
useDialTurn((ticks) => …) | The dial was turned; clockwise is positive |
useKeyPressed(), useSensorPressed(), useDialPressed() | Whether it is down |
useKeyRepeat(...), useSensorRepeat(...), useDialRepeat(...) | Again and again while down |
useSwipe(...) | Swipes across the sensors or the touch strip |
Time and place
| Hook | What it gives |
|---|---|
useNow(everyMs) | The time, kept current |
useInterval(callback, ms) | Calls it again and again |
useSlot() | Where it is drawn, and how large |
usePage(), useNavigation() | The page, and how to change it |
useDimmed() | Whether the deck is dimmed |
Live values
| Hook | What it gives |
|---|---|
useHostState("system.cpu") | Any live value |
useShared(source) | A Shared source |
useExpression(text), useTemplate(text) | What an expression or a text with {{templates}} says now |
useVariable(name) | One of the user's variables |
useImage("icon:lucide/sun", color) | A picture's address, ready for <img> |
useRunAction() | Runs another action |
A live value made with plugin.state has a hook of its own: temperature.use().