# MouseRegion

> This page is about FlutterFlow Studio (the visual builder), not FlutterFlow (the app builder you use by describing your app).

URL: https://docs.flutterflow.io/resources/ui/widgets/built-in-widgets/mouse-region

Learn how to respond to pointer hover events with the MouseRegion widget in FlutterFlow Studio.

The **MouseRegion** widget detects when a mouse pointer enters or leaves the area occupied by its child. You can use these events to start an animation, show additional content, or update another part of the interface while the pointer is hovering.

:::note
MouseRegion interactions are designed for web and desktop apps used with a mouse or a trackpad. Provide a tap-based alternative for touch devices, and do not make essential actions available only on hover.
:::

A pointer enters a MouseRegion and triggers On Mouse Enter, then leaves and triggers On Mouse Exit.

The following preview shows how a widget can respond when the pointer enters and leaves its MouseRegion:

<div style={{
    position: 'relative',
    paddingBottom: 'calc(45.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
    height: 0,
    width: '100%'
}}>
    <iframe
        src="https://demo.arcade.software/HEF6ons42zeajxNapdr7?embed&show_copy_link=true"
        title="Preview MouseRegion pointer events"
        style={{
            position: 'absolute',
            top: 0,
            left: 0,
            width: '100%',
            height: '100%',
            colorScheme: 'light'
        }}
        frameborder="0"
        loading="lazy"
        webkitAllowFullScreen
        mozAllowFullScreen
        allowFullScreen
        allow="clipboard-write">
    </iframe>
</div>

## Adding a MouseRegion Widget

1. Open the [Widget Palette](https://docs.flutterflow.io/flutterflow-ui/widget-palette) and add the **MouseRegion** widget from **Base Elements**.
2. Add the widget that should respond to hover as the child of **MouseRegion**.
3. Set the child's size and position. The MouseRegion covers the area occupied by its child.
4. Select **MouseRegion** and open the **Actions** tab to configure its [pointer events](#mouseregion-events).

The following walkthrough demonstrates how to add MouseRegion and configure its events:

<div style={{
    position: 'relative',
    paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
    height: 0,
    width: '100%'
}}>
    <iframe
        src="https://demo.arcade.software/C01xFFlctqQNosODlOZK?embed&show_copy_link=true"
        title="Add a MouseRegion widget and configure its pointer events"
        style={{
            position: 'absolute',
            top: 0,
            left: 0,
            width: '100%',
            height: '100%',
            colorScheme: 'light'
        }}
        frameborder="0"
        loading="lazy"
        webkitAllowFullScreen
        mozAllowFullScreen
        allowFullScreen
        allow="clipboard-write">
    </iframe>
</div>

## MouseRegion Events

The following events are available from the MouseRegion widget's **Actions** tab:

### On Mouse Enter

**On Mouse Enter** runs when the pointer moves into the MouseRegion. Use it to show content, start a [widget animation](https://docs.flutterflow.io/concepts/animations/widget-animations#animation-on-action-trigger), or update a state variable.

### On Mouse Exit

**On Mouse Exit** runs when the pointer leaves the MouseRegion. Use it to hide content, stop or reverse an animation, or reset a state variable.

## Customizing

Select the **MouseRegion** widget and open **MouseRegion Properties** in the [Properties Panel](https://docs.flutterflow.io/flutterflow-ui/builder#properties-panel).

### Changing the Mouse Cursor

Use **Mouse Cursor** to choose the cursor style shown while the pointer is inside the MouseRegion.

When the child is clickable, choose a cursor that communicates that interaction. A suitable cursor helps users understand what they can do before they interact.

### Controlling Overlapping MouseRegions

Enable **Opaque** when this MouseRegion should prevent MouseRegion widgets behind it from responding to the pointer. This is useful when MouseRegions overlap, such as inside a Stack, and only the region in front should receive hover events.

Disable **Opaque** when MouseRegion widgets behind it should remain responsive to the pointer.

#### Example: Icon Over a Hoverable Card

Suppose a Stack contains a product card that changes elevation on hover and a favorite icon positioned over the card. Both widgets have their own MouseRegion.

- Enable **Opaque** on the favorite icon's MouseRegion when hovering over the icon should show its tooltip without also changing the card's elevation.
- Disable **Opaque** when hovering over the favorite icon should trigger both the icon and card hover effects.

## Best Practices

- Treat hover as an enhancement and provide a tap-based alternative for touch devices.
- Keep essential actions and information accessible without requiring hover.
- Keep the MouseRegion's size stable while the pointer is inside it to prevent repeated enter and exit events.
- Choose a cursor that accurately communicates the interaction.
- Test the hover interaction with a mouse and a trackpad. Separately test the tap and keyboard alternatives provided for users who cannot use hover.
