Introduction
Welcome to Declarative Auth Forms - a modern approach to building authentication UIs with JSON Schema and shadcn/ui.
What is Declarative Auth Forms?
Declarative Auth Forms is a library that allows you to define authentication forms using simple JSON schemas. Instead of writing repetitive form code, you describe what you want, and the library generates beautiful, accessible forms styled with shadcn/ui components.
Key Features
- •Define forms with declarative JSON schemas
- •Built on shadcn/ui for beautiful, accessible components
- •Seamless integration with Better Auth
- •Type-safe with TypeScript support
- •Customizable validation and styling
- •Zero configuration required
Quick Example
Here's a simple login form defined with JSON:
schema.json
{
"type": "login",
"fields": [
{
"name": "email",
"type": "email",
"label": "Email Address",
"placeholder": "you@example.com",
"required": true
},
{
"name": "password",
"type": "password",
"label": "Password",
"required": true
}
],
"submit": "Sign In",
"footer": {
"text": "Don't have an account?",
"link": {
"text": "Sign up",
"href": "/signup"
}
}
}This JSON schema automatically generates a fully functional, styled login form with validation, error handling, and accessibility features built in.