You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Server component for Astro (validation and state management)
Full feature server components for Astro.js
This package is a framework for Astro.js that allows you to create forms and manage their state without any JavaScript.
It also allows you to validate the form on the client side and server side, and protect against CSRF attacks.
More features
JWT session management
Override response at runtime (useful for error handling)
Custom server validation withzod
Multiples app states at the same time
Show me the code
---import {Bind,BindForm,BButton,BInput }from"@astro-utils/forms/forms.js";importLayoutfrom"../layouts/Layout.astro";const form=Bind();let showSubmitText:string;function formSubmit(){showSubmitText=`You name is ${form.name}, you are ${form.age} years old.`;}---<Layout> <BindFormbind={form}>{showSubmitText} <h4>What you name*</h4> <BInputtype="text"name="name"maxlength={20}required/> <h4>Enter age*</h4> <BInputtype="int"name="age"required/> <BButtononClick={formSubmit}whenFormOK>Submit</BButton> </BindForm></Layout>