Skip to content
Tutorials Center
My learning

Topics

Lesson 26 of 36 ยท Prototyping and Interactions

Overlays, Scrolling and Conditions

Build realistic Figma prototypes with overlays (modals, menus), scrolling frames, fixed headers and variable-based conditional logic.

Real apps do more than jump between full screens. Modals appear over content, long pages scroll, a header stays fixed, and a button behaves differently depending on earlier choices. Figma prototypes can model all of this with overlays, overflow scrolling and variables with conditions.

Figma cannot run on this site. The examples are labelled JavaScript stand-ins that model overlay stacks, scroll limits and conditions. They are not Figma's real engine.

Overlays

An overlay is a frame that opens on top of the current frame without leaving it. Use it for modals, dropdown menus, tooltips, toasts and bottom sheets. To create one:

  1. Design the overlay as its own frame (for example a 320 by 200 dialog).
  2. Select the trigger layer, add an interaction, and choose Open overlay, then pick the overlay frame.
  3. Set the position: Center, Top left ... Bottom right, Manual (anchored where you drop it), or Relative to the trigger layer.
  4. Tick Close when clicking outside to dismiss on a backdrop click, and Add background behind overlay with a color and opacity to dim the page.

Inside the overlay, a close button uses Close overlay. Swap overlay replaces the current overlay with another without closing, which is useful for wizard-like dialogs. Overlays can stack: opening a second one puts it on top of the first.

flowchart TD
    P["Page frame"] -->|"Open overlay"| M["Menu"]
    M -->|"Open overlay"| D["Delete dialog"]
    D -->|"Close overlay"| M
    M -->|"Close overlay"| P

Overlays form a stack: Close removes the top one only.

The stand-in below models the stack.

JS Stand-in: an overlay stack

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

No output.

Scrolling

A frame scrolls in a prototype only if its content is taller or wider than the frame and you set the frame's Overflow behavior in the Prototype tab:

  • No scrolling (default)
  • Vertical scrolling
  • Horizontal scrolling
  • Horizontal and vertical scrolling

Make a tall design by letting child layers extend beyond the frame's bottom edge. The frame clips them, and the prototype reveals them as you scroll. Check that Clip content is on for the frame.

Fixed layers

A header or bottom navigation bar should stay put while content moves. Select that layer and tick Fix position when scrolling in the Prototype tab. It then floats above the scrolling content. Without it, the header scrolls away.

Scrolling inside nested frames

A carousel is a frame inside a frame with horizontal scrolling; the outer page scrolls vertically. Use a nested frame whose content is wider than itself. Be careful with diagonal scrolling: users expect one direction per region.

Scroll limits

How far does a frame scroll? The content height minus the frame height, as the stand-in shows.

JS Stand-in: how far can a frame scroll?

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

No output.

Variables and conditions

Prototype variables hold values that interactions can read and change. Figma supports variable types Boolean, Number, String and Color. Create them in the Local variables panel (the sliders icon in the right panel when nothing is selected), then use them in the Prototype tab:

  • Set variable: assign a value, for example cartCount = cartCount + 1 (number variables support basic arithmetic).
  • Set variable mode: switch a collection's mode, such as light and dark.
  • Conditional: if / else if / else blocks that check variables and decide which actions run.

For example: on tapping "Add to cart", set cartCount to cartCount + 1; then on the cart button, if cartCount > 0 navigate to Cart, else navigate to Empty cart. The count can also show in a badge by binding a text layer to the number variable.

Conditions let one button do many jobs, so you need fewer duplicate frames. A login screen can use a Boolean isLoggedIn to decide whether the profile icon opens the account page or the login page.

Simulating a conditional prototype

The stand-in below acts out the cart example, applying actions and conditions in order.

JS Stand-in: variables and conditions

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

No output.

Tips for believable prototypes

  • Fake only what you need. If testing the checkout, hard-code cart items; do not build full state.
  • Name variables like code: isMenuOpen, selectedTab.
  • Use overlays instead of duplicating pages with a modal on top; it keeps screens clean.
  • Fix headers and nav bars, or users will say the prototype "feels broken".
  • Test scroll on a real phone via the Figma mobile app, where touch behaves differently from a mouse wheel.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which action puts a modal on top of the current frame?

    Open overlay shows the destination frame above the current one.
  2. 2. A header must stay visible while the page scrolls. What do you enable?

    That prototype setting floats the layer above scrolling content.
  3. 3. Which variable types does Figma support?

    Figma variables come in four types: Boolean, Number, String and Color.
  4. 4. What does a Conditional block do?

    Conditionals check variables with if and else branches.

Summary

  • Overlays open on top of the current frame and stack; Close overlay removes the top one.
  • Frames scroll when their overflow is set and content is larger; fix headers with Fix position.
  • Variables with Set variable and Conditional add logic so one frame can serve many states.
  • Keep prototypes focused and test on real devices.

Next: Variables and Modes