Form
A <form> that validates the rules of the fields inside it. Everything about rules, custom
checks and server-side validation is in the Form validation guide.
---import { Button, Form, TextInput } from 'bws-astro-ui';import { email, required } from 'bws-astro-ui/rules';---
<Form method="post" validateOn="blur"> <TextInput name="email" label="Email" rules={[required(), email()]} /> <Button type="submit">Send</Button></Form>Behavior
Section titled “Behavior”- Fields with
rulesshow their message in place of the hint and getaria-invalid. - A submit checks every field first; while anything is invalid it’s stopped, the first invalid
field gets focus and your
submithandlers on the form don’t run. resetclears all messages.- The browser’s own validation bubbles are turned off once the script runs; without JavaScript the native attributes from the rules still validate.
| Prop | Type | Default |
|---|---|---|
validateOn |
blur · input · submit — when fields start validating |
blur |
Any other attribute (method, action, id…) goes to the <form>. Slot: default — the
fields.