一覧へ戻る
form-atoms/field(新しいタブで開きます)
主要言語: TypeScript
FieldAtoms extended with required state and validated by zod schema.
- star 数
- 19
- watcher 数
- 1
- fork 数
- 2
- issue 数
- 2
- 最終更新
- 2026/09/25
主要言語: TypeScript
FieldAtoms extended with required state and validated by zod schema.
A zod powered fieldAtoms with pre-configured schemas for type & runtime safety.
npm install @form-atoms/field jotai-effect zod
undefined empty valuez.optional()import { textField, numberField, stringField, Select } from "@form-atoms/field"; import { fromAtom, useForm, InputField } from "form-atoms"; const personForm = formAtom({ name: textField(), age: numberField({ schema: (s) => s.min(18) }); // extend the default schema character: stringField().optional(); // make field optional }); export const Form = () => { const { fieldAtoms, submit } = useForm(personForm); return ( <form onSubmit={submit(console.log)}> <InputField atom={fieldAtoms.name} label="Your Name" /> <InputField atom={fieldAtoms.age} label="Your age (min 18)" /> <Select field={fieldAtoms.character} label="Character" options={["the good", "the bad", "the ugly"]} getValue={(option) => option} getLabel={(option) => option} /> </form> ); };
See Docs for more.
@form-atoms/field comes pre-wired to popular UI libraries:
| 📦Package | 🎨 Storybook | About |
|---|---|---|
| flowbite | Flowbite Fields | Bindigs to Tailwind component library Flowbite |