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

# Plugins

> React components placed inside the EditorProvider to register behaviors and extend the Portable Text Editor.

import {CardGrid, LinkCard} from '@astrojs/starlight/components'

Plugins are React components placed inside the `EditorProvider`, and are primarily used to register [Behaviors](/editor/concepts/behavior/) ad-hoc in the Editor using the `editor.registerBehavior(...)` API:

```tsx
function LogTextPlugin() {
  const editor = useEditor()

  useEffect(() => {
    const unregisterBehavior = editor.registerBehavior({
      behavior: defineBehavior({
        on: 'insert.text',
        actions: [
          ({event}) => [
            {
              type: 'effect',
              effect: () => {
                console.log(event)
              },
            },
            {
              type: 'forward',
              event,
            },
          ],
        ],
      }),
    })

    return () => {
      unregisterBehavior()
    }
  }, [editor])

  return null
}
```

## Available plugins

<CardGrid>
  <LinkCard
    title="@portabletext/plugin-character-pair-decorator"
    description="Automatically match a pair of characters and decorate the text in between."
    href="https://github.com/portabletext/editor/tree/main/packages/plugin-character-pair-decorator"
  />
  <LinkCard
    title="@portabletext/plugin-emoji-picker"
    description="Easily configure an Emoji Picker for the Portable Text Editor."
    href="https://github.com/portabletext/editor/tree/main/packages/plugin-emoji-picker"
  />
  <LinkCard
    title="@portabletext/plugin-input-rule"
    description="Easily configure Input Rules in the Portable Text Editor."
    href="https://github.com/portabletext/editor/tree/main/packages/plugin-input-rule"
  />
  <LinkCard
    title="@portabletext/plugin-markdown-shortcuts"
    description="Adds helpful Markdown shortcuts to the editor."
    href="https://github.com/portabletext/editor/tree/main/packages/plugin-markdown-shortcuts"
  />
  <LinkCard
    title="@portabletext/plugin-one-line"
    description="Restricts the Portable Text Editor to a single line."
    href="https://github.com/portabletext/editor/tree/main/packages/plugin-one-line"
  />
  <LinkCard
    title="@portabletext/plugin-paste-link"
    description="Allows pasting links in the Portable Text Editor"
    href="https://github.com/portabletext/editor/tree/main/packages/plugin-paste-link"
  />
  <LinkCard
    title="@portabletext/plugin-sdk-value"
    description="Connects a Portable Text Editor with a Sanity document using the SDK."
    href="https://github.com/portabletext/editor/tree/main/packages/plugin-sdk-value"
  />
  <LinkCard
    title="@portabletext/plugin-typeahead-picker"
    description="Generic typeahead picker infrastructure for the Portable Text Editor."
    href="https://github.com/portabletext/editor/tree/main/packages/plugin-typeahead-picker"
  />
  <LinkCard
    title="@portabletext/plugin-typography"
    description="Automatically transform text to typographic variants."
    href="https://github.com/portabletext/editor/tree/main/packages/plugin-typography"
  />
</CardGrid>