Documentation
¶
Overview ¶
Package events is the compiled source for docs/guide/events-and-forms.md.
It is a composer: a form that submits, a field that reports every keystroke, a checkbox whose absence means something, and a key that clears the draft.
templ: version: v0.3.1020
Index ¶
Constants ¶
const ( EventSubmit = "compose.submit" EventDraft = "compose.draft" EventClear = "compose.clear" )
The event names. Every one of them is in Config.Events; a name that is not there is refused with UNKNOWN_EVENT and counted, and never reaches Reduce.
const ( FieldBody = "body" FieldUrgent = "urgent" )
The form field names. They are the name attributes in view.templ and the keys Fields is read with, so they are constants rather than two spellings of one string.
const MaxBody = 140
MaxBody is the length the reducer enforces. The client enforces nothing: validation is state the server computes, and the browser is not asked to agree.
Variables ¶
This section is empty.
Functions ¶
func ComposerRegion ¶
ComposerRegion is the whole vocabulary in one fragment.
The form's submit binding sends every field the form contains. The input's own binding sends that one control, debounced. The key binding clears the draft and fires for no key but Escape. All three go through one client listener and one server event path.
The two bindings on the input are composed with live.OnAll and only one of them is debounced. That is the whole of it now, and it is worth one sentence because it was not always so: until 2026-08-05 Debounce was an attribute of the element, so the Escape binding inherited the input's 150 ms and a keystroke inside that window destroyed the pending clear outright. This component is the page that defect was found on.
aria-invalid and aria-describedby are written by hand, deliberately: they are markup decisions belonging to this application's design system, and the library ships no form vocabulary that would own them.