Hotspots
Non-blocking beacons for contextual hints and "what's new" callouts.
Not everything deserves a tour. A hotspot is a pulsing beacon attached to an element that reveals a hint when clicked — without blocking the page.
Loopworknight-drive.lwp
Beat A
16 steps · drumsKick
Snare
Hat
Clap
Mixer
4 channelsDrums
80%
Bass
35%
Keys
60%
Vox
50%
Non-blocking: keep playing, tweak a knob, then open a beacon.
import { LoopworkApp, part } from '@loopwork';import { HotspotHint } from '@/components/awesome-tour/hotspot';import { DemoFrame } from './ui';
export function HotspotDemo() { return ( <DemoFrame title="Hotspots" footer="Non-blocking: keep playing, tweak a knob, then open a beacon." > <LoopworkApp scope="hints" layout="compact"> <HotspotHint target={part('hints', 'fx-slot')} title="New: tape saturation" beaconLabel="What’s new in drum effects" side="left" > Warm up the drum bus. Open the effects and switch on Tape. </HotspotHint> <HotspotHint target={part('hints', 'bpm')} title="Tip" label="Tip about the tempo" beaconLabel="Tip about the tempo" side="bottom" > Click the BPM and use ↑ ↓ to nudge the tempo by one. </HotspotHint> </LoopworkApp> </DemoFrame> );}import { Hotspot } from '@awesome-tour/react';
<Hotspot.Root target="#reports"> <Hotspot.Beacon className="beacon" aria-label="What's new in reports" /> <Hotspot.Portal> <Hotspot.Content className="hint" side="bottom"> <strong>New:</strong> export any report as PDF. <Hotspot.Close aria-label="Close">✕</Hotspot.Close> </Hotspot.Content> </Hotspot.Portal></Hotspot.Root>;.beacon { width: 14px; height: 14px; border-radius: 50%; background: var(--accent);}.beacon::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: pulse 1.6s ease-out infinite;}@keyframes pulse { to { transform: scale(2.6); opacity: 0; }}targetaccepts everything a step target does, includinganchor(); the beacon appears once the target exists and follows it.- The beacon sits on the target’s top-end corner by default; change it with
side,alignand the offsets. open/defaultOpen/onOpenChangemake it controlled.- A hotspot is a great entry point to a full tour: put a
Tour.TriggerinsideHotspot.Content.
Remembering hints
Give a hotspot an id and a persistence adapter and it remembers
it was opened; the beacon gets data-seen (stop the pulse with [data-seen]::after { animation: none }). With once, it stops showing after it has been opened and closed:
const hints = localStorageAdapter<HotspotRecord>({ prefix: 'hints:' });
<Hotspot.Root id="pdf-export" target="#export" persistence={hints} once>…</Hotspot.Root>| Prop | Default | Description |
|---|---|---|
id |
— | Key under which persistence remembers the hint. |
persistence |
— | A PersistenceAdapter<HotspotRecord>. |
once |
false |
Hide for good once opened and closed. |
trigger |
'click' |
'hover' opens on pointer hover and keyboard focus. |
hideDuringTours |
true |
Hide the beacon while a modal tour from TourProvider is on screen. |
Full API in the Hotspot reference.