> ## Documentation Index
> Fetch the complete documentation index at: https://layerswaplabsv0-main-depositactionsguide.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# onSwapModalStateChange

> Triggered when the swap modal opens or closes.

The `onSwapModalStateChange` event fires whenever the swap modal is opened or closed.

```tsx theme={null}
<LayerswapProvider
  callbacks={{
    onSwapModalStateChange: (open) => {
      console.log("Modal state:", open ? "open" : "closed")
    },
  }}
>
  <Swap />
</LayerswapProvider>
```

### Callback Argument Value

```TypeScript theme={"system"} theme={null}
open: boolean
```
