> For the complete documentation index, see [llms.txt](/llms.txt).
> The full corpus is at [llms-full.txt](/llms-full.txt).

# EventListenerPlugin

> **EventListenerPlugin**(`props`): `null`

Defined in: plugin.event-listener.tsx:54

Listen for events emitted by the editor. Must be used inside `EditorProvider`. Events available include:
 - 'blurred'
 - 'done loading'
 - 'editable'
 - 'error'
 - 'focused'
 - 'invalid value'
 - 'loading'
 - 'mutation'
 - 'patch'
 - 'read only'
 - 'ready'
 - 'selection'
 - 'value changed'

## Parameters

### props

#### on

(`event`) => `void`

## Returns

`null`

## Examples

Listen and log events.
```tsx
import {EditorProvider} from '@portabletext/editor'
import {EventListenerPlugin} from '@portabletext/editor/plugins'

function MyComponent() {
 return (
 <EditorProvider>
  <EventListenerPlugin
   on={(event) => {
    console.log(event)
   }
  } />
  { ... }
</EditorProvider>
 )
}
```

Handle events when there is a mutation.
```tsx
<EventListenerPlugin
 on={(event) => {
   if (event.type === 'mutation') {
     console.log('Value changed:', event.snapshot)
   }
 }}
/>
```