Forms

Inputs, binding, and form state.

Text inputs

Bind inputs to state for two-way data binding:

state email = "" input bind=email type="email" placeholder="Enter email" p email

Textarea

state message = "" textarea bind=message placeholder="Your message"

Buttons with actions

Use the -> operator to handle button clicks:

state submitted = 0 button "Submit" -> submitted = 1 p submitted

Complete form example

state name = "" state email = "" state count = 0 section { style { bg #0a0a1a, padding 2rem, radius 12px } h2 "Contact Form" input bind=name placeholder="Name" input bind=email type="email" placeholder="Email" button "Submit" -> count = count + 1 p count }

CSRF tokens for form submissions are planned for v0.4.

← Animations Security →