Toolbar Buttons

Work with text selections in writer and textarea fields.

Kirby Copilot v2 introduces a copilot button for the Kirby writer and textarea fields.

Open the prompt dialog by clicking the Copilot button in the toolbar. The selected text (if any) will be appended to the user prompt before sending it to the AI model. Follow the selected text section for more information.

This feature is useful when you need to generate content based on existing text, or when you want to generate content for a specific part of the text. It is also useful for nested fields such as writer fields in blocks.

You can also define custom user prompts that will be pre-filled when the Copilot prompt dialog is opened.

Keyboard Shortcuts

Open the prompt dialog with keyboard shortcuts:

FieldShortcut
WriterCmd + . (macOS) / Ctrl + . (Windows/Linux)
Textarea. (period key)
The shortcuts work in every writer and textarea field, even if you have not added the Copilot button to the toolbar.

Append vs Replace

For text fields (text, textarea, writer), the prompt dialog shows an Append/Replace toggle:

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

Cancel Generation

Press Escape to cancel generation mid-stream.

Prompt History

Your prompts are saved in the browser's local storage (up to 50 entries per site). Navigate with arrow keys.

See the Quick Reference for all keyboard shortcuts.

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

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 Fields as Context documentation to learn how to use content placeholders in your prompts.

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:
      userPrompt: Check grammar and improve writing style. Keep the original meaning and tone.

The custom prompt can be edited before generating content.

For nested fields in blocks or layouts, add copilot.userPrompt to the nested field definition.

Selected Text

When you select text in the writer or textarea field and then click the Copilot button, the selected text will be passed to the prompt dialog.

Before the instruction is sent to your AI provider, the selected text is added to the user prompt.

For example, if this is your user prompt:

Shorten the selected text to 200 characters.

Then, the selected text will be added to the prompt, resulting in this final prompt:

Shorten the selected text to 200 characters.

<selected_text>
(Your selected text will be here)
</selected_text>
The Default System Prompt is designed to instruct the AI model on how to process the selected text.