For the complete documentation index, see llms.txt. This page is also available as Markdown.

x-submittable-textarea

A directive that adds Cmd+Enter or Ctrl+Enter as a textarea submit shortcut.

A directive that adds a keyboard submit shortcut to a textarea.

Directive
What it does

x-submittable-textarea

Cmd+Enter on Mac, or Ctrl+Enter elsewhere, submits the closest <form>

The shortcut calls requestSubmit(), so browser validation and submit handlers run the same as a click on the submit button. A textarea swallows plain Enter for new lines, so the modifier key is what makes submitting from the keyboard possible.

Examples

A submit shortcut on a comment form

Use x-submittable-textarea on the textarea of any form:

<form method="post">
  <textarea name="comment[body]" rows="8" required x-submittable-textarea></textarea>
  <button type="submit">Post comment</button>
</form>

Analog uses this on the article comment form and on the gift card recipient message, so a shopper who finishes typing can submit without reaching for the mouse.

Options

x-submittable-textarea takes no expression and no modifiers.

Last updated

Was this helpful?