Components
← All components

Highlight on Insert

stimeo--highlight

Briefly flags a freshly inserted element so CSS can flash / fade it in, then clears it.

The stimeo--highlight controller flags a freshly inserted element with data-highlight so CSS can flash or fade it in, then removes the flag after duration ms — replacing hand-rolled setTimeout bookkeeping. In the default (self) mode the controller element is highlighted once on connect; with observe it switches to container mode, where a MutationObserver highlights every element child added to it (e.g. Turbo Stream appends). Each highlight dispatches stimeo--highlight:start and, on removal, stimeo--highlight:end, both carrying detail.element. Behavior only — it ships no color or animation, just the hook (pair with CSS, and with Announcer / Flash for non-visual notice). Under prefers-reduced-motion the emphasis is suppressed entirely (the element simply appears). The self hook is removed before its duration elapses so it never lingers into a Turbo cache snapshot, and the observer and pending timers are torn down on disconnect (Turbo navigation included).

running
  • Item 1
  • Item 2

Each new row is briefly highlighted, then fades back. The container runs in observe mode.