# LayoutInteractEvent > Fired when a player interacts with an element of a layout page they have open. `gg.lode.lecternapi.api.event.LayoutInteractEvent` --- ## Signature ```java public class LayoutInteractEvent extends LecternClientEvent implements Cancellable ``` --- ## Notes Fired before the page's own `LayoutAction`s run, and cancelling it stops them, which is how a plugin gates a page's buttons on something the page itself cannot express, like a permission or a cooldown, without having to strip the bindings out of the file. Only fires for a page the server believes the player has open. A client reporting a click on a page that is not showing is ignored rather than trusted. --- ## Methods ### getPageId ```java public String getPageId() ``` The page the interaction happened on. --- ### getElementRef ```java public String getElementRef() ``` The element's reference, or empty when the interaction is the page's own. --- ### getTrigger ```java public LayoutAction.Trigger getTrigger() ``` --- ### isCancelled ```java public boolean isCancelled() ``` --- ### setCancelled ```java public void setCancelled(boolean cancelled) ``` | Parameter | Type | |---|---| | `cancelled` | `boolean` | --- ## Example Gate a page's buttons on a permission the page itself cannot express: ```java @EventHandler public void onLayoutInteract(LayoutInteractEvent event) { if (!event.getPageId().equals("admin_panel")) return; if (event.getTrigger() != LayoutAction.Trigger.CLICK) return; if (!event.getPlayer().hasPermission("mygame.admin")) { event.setCancelled(true); event.getPlayer().sendMessage("Not for you."); } } ``` It fires before the element's own actions, so cancelling stops them. `getElementRef()` is empty when the interaction belongs to the page rather than to an element on it. --- ## Related Pages - [[LayoutAction]]. The triggers and what they run - [[ILayoutManager]]. Firing an element's actions yourself