Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add new features to our docs site #228

Open
ayoayco opened this issue Dec 5, 2022 · 0 comments
Open

docs: Add new features to our docs site #228

ayoayco opened this issue Dec 5, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@ayoayco
Copy link
Member

ayoayco commented Dec 5, 2022

Update our API docs to include the new features!

form

1. Form validateOnLoad prop done
2. FormGroup.setValue()

validator

  1. categories: error, warn, info

You may also check the demo app examples in apps/demo

More sample code:

---
import Form, { FormGroup } from "@astro-reactive/form";
import { Validators } from "@astro-reactive/validator";
const formGroup = new FormGroup([
  {
    name: "text",
    label: "Name",
    type: "text",
    placeholder: "Enter your name",
    validators: [
      {
        validator: Validators.required,
        category: "warn",
      },
    ],
  },
  {
    name: "email",
    label: "Email",
    type: "email",
    placeholder: "Enter your email",
    validators: [Validators.required, Validators.email],
  },
  {
    name: "password",
    label: "Password",
    type: "password",
    placeholder: "Enter your password",
  },
]);

formGroup.setValue({
  text: "John Doe",
  email: "invalid-email",
});
---

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
    <meta name="viewport" content="width=device-width" />
    <meta name="generator" content={Astro.generator} />
    <title>Astro</title>
  </head>
  <body>
    <h1>Astro</h1>
    <Form
      validateOnLoad={true}
      showValidationHints={true}
      formGroups={formGroup}
    />
  </body>
</html>
@ayoayco ayoayco added documentation Improvements or additions to documentation accepting PRs labels Dec 5, 2022
@ayoayco ayoayco self-assigned this Mar 5, 2023
@ayoayco ayoayco removed their assignment Dec 3, 2023
@ayoayco ayoayco removed the urgent label Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant