Toolbar Buttons

Work with text selections in writer and textarea fields.

Kirby Copilot provides a copilot button for writer and textarea fields. Click it to open the prompt dialog and generate content directly within the field – especially useful for nested fields like writer fields in blocks.

If you select text before opening the dialog, the selection is automatically appended to your prompt. See the selected text section for details.

You can define custom user prompts that are pre-filled when the dialog opens.

Writer Fields

If you only want to add the Copilot button to the toolbar without removing the default marks, you must first define all default markers in the field configuration, followed by the copilot button.

Copilot button in writer field toolbar
pages/default.yml
fields:
  text:
    label: Text
    type: writer
    toolbar:
      inline: false
    marks:
      # These are the default marks
      - bold
      - italic
      - underline
      - strike
      - code
      - "|"
      - link
      - email
      - "|"
      - clear
      - "|"
      # Append the Copilot button to the toolbar
      - copilot
      # Enable inline suggestions
      - copilot-suggestions
When defining custom marks, include copilot-suggestions to enable inline suggestions. Without it, suggestions are silently disabled because Kirby filters marks based on your blueprint.

Textarea Field

Similarly, you can add the Copilot button to the toolbar of a textarea field. The configuration is the same as for the writer field, but with buttons instead of marks.

Copilot button in textarea field toolbar
pages/default.yml
fields:
  text:
    label: Text
    type: textarea
    buttons:
      # These are the default buttons
      - headlines
      - "|"
      - bold
      - italic
      - code
      - "|"
      - link
      - email
      - file
      - "|"
      - ul
      - ol
      - "|"
      # Append the Copilot button to the toolbar
      - copilot
This can be useful for generating meta descriptions based on the main content of a page, or for generating a summary of a text block. See the Field Placeholders guide to learn how to reference other fields as context in your prompts.

Shared Usage

Keyboard Shortcuts

ActionShortcut
Open prompt (writer & textarea field) . (macOS) / CTRL . (Windows/Linux)
Cancel generationEsc
The shortcuts work in every writer and textarea field, even if you have not added the Copilot button to the toolbar.

Selected Text

When you select text in a writer or textarea field before clicking the Copilot button, the selection is appended to your prompt. Formatting (bold, italic, links, etc.) is preserved in the selection and in the generated output when replacing text. This makes prompt templates like Fix Grammar or Make Concise especially useful: correct errors or shorten text while keeping all your formatting intact.

For example, if this is your user prompt:

Shorten the selected text to 200 characters.

The selected text is wrapped and appended:

Shorten the selected text to 200 characters.

<selection>
(Your selected text will be here)
</selection>
The Default System Prompt instructs the AI model on how to process the selected text.

Append vs Replace

The prompt dialog shows an Append/Replace toggle when opened from a writer or textarea field.

  • Replace (default): Overwrites existing field content with generated text.
  • Append: Adds generated text after existing content.

Predefined User Prompts

Define a custom userPrompt for writer and textarea fields to pre-fill the Copilot dialog when the toolbar button is clicked.

pages/default.yml
fields:
  text:
    label: Text
    type: writer
    marks:
      - bold
      - italic
      - "|"
      - copilot
      - copilot-suggestions
    copilot:
      userPrompt: Check grammar and improve writing style. Keep the original meaning and tone.

The custom prompt can be edited before generating content.