> ## Documentation Index
> Fetch the complete documentation index at: https://docs.layerswap.io/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 in-flow swap details modal opens or closes. This is the modal shown over the active swap flow, not the Widget's main card or wallet-connect dialog.

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

### Callback Argument Value

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