Skip to content
Tutorials Center
My learning

Topics

Lesson 24 of 36 ยท Prototyping and Interactions

Triggers and Actions

Understand Figma prototype triggers (on click, hover, drag, after delay) and actions (navigate, back, overlays, set variable) and how interactive components use them.

Every interaction in a Figma prototype is a sentence with three parts: when something happens (the trigger), what it does (the action), and how it looks while it happens (the animation). Learning the vocabulary of triggers and actions lets you describe almost any behavior in a few clicks.

Figma cannot run on this site. The examples here are labelled JavaScript stand-ins: small state machines that mimic the trigger and action model. They are not Figma's real runtime.

Triggers

A trigger is the event that starts the interaction. Common triggers in the Prototype tab:

Trigger Fires when
On click / On tap The user clicks or taps the layer
On drag The user drags across the layer
While hovering The pointer stays over the layer; reverts when it leaves
While pressing The pointer is held down; reverts on release
Mouse enter / Mouse leave The pointer crosses the boundary once
Mouse down / Mouse up The button is pressed or released
Key / Gamepad A chosen key or button is pressed
After delay A set number of milliseconds passes after the frame appears

"While hovering" and "While pressing" are special because they are temporary: the change undoes itself when the user stops. "Mouse enter" is a one-time change, so you would need another interaction to undo it. Prefer the "while" triggers for hover effects.

Remember touch devices have no hover. Never hide essential information behind a hover.

Actions

The action is what the trigger causes:

  • Navigate to a frame.
  • Back, to the previous frame in history.
  • Scroll to a layer inside the current frame.
  • Open overlay, Swap overlay or Close overlay (see Overlays, Scrolling and Conditions).
  • Open link, to a URL in a new tab.
  • Change to a variant of the same component (for interactive components).
  • Set variable or Set variable mode, and Conditional, to add logic.

Several actions can be attached to one trigger. A single click might set a variable and navigate to another frame.

A trigger-action table in code

Think of the prototype as a lookup from (state, trigger) to (action, next state). The stand-in below simulates a login button flow.

JS Stand-in: a prototype as a state machine

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Notice click:Back returns to the previous frame because the history stack remembers it, just as Figma's Back action does.

Interactive components

Putting interactions inside a component makes behavior travel with it. Open a variant set, select a variant, and add an interaction in the Prototype tab with While hovering and Change to another variant. Now every instance of that component, on every screen, reacts to hover without any extra wiring.

Good candidates:

  • Buttons: default, hover, pressed.
  • Toggles and checkboxes: on/off on click.
  • Tabs and accordions: selected or expanded states.
  • Menus: open and closed.

Interactive components work best when the variants have the same size, or the layout will jump. See Variants for set-up.

stateDiagram-v2
    [*] --> Default
    Default --> Hover: while hovering
    Hover --> Default: mouse leaves
    Hover --> Pressed: while pressing
    Pressed --> Hover: release

A button's visual states form a tiny state machine; Figma maps triggers to the arrows.

Timing and "after delay"

After delay starts the countdown when the frame is shown. It is perfect for splash screens ("go to Home after 2 seconds"), toast messages that disappear, and rotating banners. Give a user time: a toast with a 400 ms delay is unreadable.

Delays run from the moment the frame appears, so a screen with a long delay and a click is a race. Test the order of events in presentation mode.

Planning with a checklist

A quick way to spot gaps is to list the interactive elements of a screen and check each one has a trigger, an action and a way back. The stand-in below does that on a simple spec.

JS Stand-in: every interactive element needs a trigger and an action

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Tips

  • Use While hovering with Change to for hover states, not Mouse enter.
  • For toggles, add two interactions inside the component: on click switch to the other state, and back.
  • Combine After delay with Smart animate (see Smart Animate and Easing) for auto-playing demos.
  • Keep gesture triggers (drag) for things users really drag, like carousels and sliders.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which trigger reverts its effect automatically when the pointer leaves?

    While hovering shows a temporary state that goes back when the pointer leaves.
  2. 2. What does the Back action do?

    Back follows the session history rather than a fixed frame.
  3. 3. Why use interactions inside a component?

    Interactive components carry their behavior wherever they are used.
  4. 4. After delay starts counting when...

    The delay timer starts when the frame appears.

Summary

  • An interaction = trigger + action + animation.
  • "While" triggers are temporary; "Mouse enter/leave" are one-shot.
  • Actions include navigate, back, scroll to, overlays, open link, change to, and variable logic.
  • Interactive components attach behavior to variants so every instance reacts.
  • Always avoid hover-only essential content, because touch has no hover.

Next: Smart Animate and Easing