SubmitButton¶
Submit the nearest form with consistent primary-action styling.
| Import | from hedron import SubmitButton |
| Distribution | hedron |
| Backend activity | No |
| Normal render mode | RenderMode.FRAGMENT |
Live demo¶
Ready to save.
The preview is a local docs simulation (not a running Hedron server). Interactive demos show a “Simulated HTMX” trace when applicable.
Basic use¶
Compose under Page for full documents, or return from a fragment route for HTMX swaps.
How it works¶
The component fixes type=submit, avoiding the ambiguity of a generic button in a form, and applies the primary button class.
This component's core behavior is server-rendered HTML and does not require a browser runtime. The preview is ordinary semantic HTML, so keyboard, form, link, and disclosure behavior comes from the platform.
Constructor and parameters¶
| Parameter | Type | Meaning |
|---|---|---|
label |
str |
Visible submit action. |
disabled |
bool |
Prevent submission. |
Composition and backend behavior¶
Keep SubmitButton at the smallest semantic boundary. Fragment routes should return only
the replaced region and preserve stable target IDs across success, validation, empty,
loading, and error responses.
SubmitButton participates in interaction markup. Pair it with an explicit @app.action POST (and CSRF) when the control mutates state.
Accessibility¶
Use a specific verb and expose pending state without replacing the accessible name with an unexplained spinner.
Security¶
Escaping and SafeUrl / TrustedHtml are framework concerns; authorization and data
exposure remain application code. Redact secrets before rendering.
Common mistakes¶
- Do not disable the only submit path permanently after an HTMX error.
- Do not copy docs-preview JavaScript into an application server.