
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
**TypedForm** is a lightweight, unstyled React component library for building forms with ease. It leverages [React Hook Form](https://react-hook-form.com/) for robust form state management and validation, ensuring your forms are well-structured, semantica
TypedForm is a lightweight, unstyled React component library for building forms with ease. It leverages React Hook Form for robust form state management and validation, ensuring your forms are well-structured, semantically correct, and fully accessible. Inspired by the Form component from Shadcn, TypedForm provides a set of flexible components to streamline form creation in your React applications.
zod, yup, joi and more.npm install typedform react-hook-form @hookform/resolvers
# or
yarn add typedform react-hook-form @hookform/resolvers
# or
pnpm add typedform react-hook-form @hookform/resolvers
Here's a simple example to get you started with TypedForm. This example demonstrates creating a basic form with validation.
import React from 'react';
import {
Form,
FormField,
FormControl,
FormLabel,
FormDescription,
FormMessage,
} from 'typedform';
import { zodResolver } from '@hookform/resolvers/zod';
import * as z from 'zod';
const schema = z.object({
firstName: z.string().min(1, 'First name is required'),
email: z.string().email('Invalid email address'),
});
type FormData = z.infer<typeof schema>;
const ExampleForm: React.FC = () => {
const onSubmit = (data: FormData) => {
console.log(data);
};
return (
<Form
resolver={zodResolver(schema)}
onSubmit={onSubmit}
defaultValues={{
firstName: '',
email: '',
}}
>
<FormField name="firstName">
<FormLabel>First Name</FormLabel>
<FormControl>
<input type="text" />
</FormControl>
<FormDescription>Your given name.</FormDescription>
<FormMessage />
</FormField>
<FormField name="email">
<FormLabel>Email Address</FormLabel>
<FormControl>
<input type="email" />
</FormControl>
<FormDescription>We'll never share your email.</FormDescription>
<FormMessage />
</FormField>
<button type="submit">Submit</button>
</Form>
);
};
export default ExampleForm;
FormThe Form component serves as the root for your form structure. It can manage its own form instance internally or accept an external form instance provided via the form prop. Depending on whether form is supplied, the allowed props vary.
form (Internal Form Management)When the form prop is not provided, the Form component creates and manages its own form instance using react-hook-form.
Allowed Props:
resolver: Resolver function for validation (e.g., zod, yup).onSubmit: Callback function triggered on form submission with valid data.defaultValues: Initial values for the form fields.values: Controlled form values.useFormProps: Additional options for the useForm hook.children: Form elements or a render function receiving form.Example:
<Form
resolver={zodResolver(schema)}
onSubmit={(data) => console.log(data)}
defaultValues={{ firstName: '', email: '' }}
>
{/** Form content here */}
</Form>
form (External Form Instance)When the form prop is provided, the Form component uses the supplied instance, and the internal form management props are ignored.
Allowed Props:
form: An external form instance created with useForm.children: Form elements or a render function.Example:
const form = useForm({
resolver: zodResolver(schema),
defaultValues: { firstName: '', email: '' },
});
<Form form={form}>
<form onSubmit={form.handleSubmit((values) => console.log(values))}>
{/** Form content here */}
</form>
</Form>;
FormFieldFormField wraps individual form fields, managing their state and validation. It uses React Hook Form’s Controller to connect the field to the form context.
Props:
as: The component or element type to render (default: 'div').asChild: Render the field as a child component (default: false).name: The name of the field within the form.children: The form input component or a render function receiving field props.FormControlFormControl links a form input to the form state, handling accessibility attributes and error states.
Props:
as: The component or element type to render (default: 'div').children: The input component or a render function receiving field props.FormLabelFormLabel associates a label with a form field, ensuring accessibility by linking via htmlFor.
Props:
as: The component or element type to render (default: 'label').asChild: Render the field as a child component (default: false).children: The child content of the label.FormDescriptionFormDescription provides descriptive text for a form field, enhancing accessibility by associating the description with the field.
Props:
as: The component or element type to render (default: 'p').asChild: Render the field as a child component (default: false).children: The child content of the description.FormMessageFormMessage displays validation error messages for a form field.
Props:
as: The component or element type to render (default: 'p').asChild: Render the field as a child component (default: false).children: Custom error message content or a render function receiving the error object.TypedForm is built with accessibility in mind. It utilizes ARIA attributes, proper labeling, and ensures keyboard navigability to provide an inclusive user experience.
Since TypedForm provides unstyled components, you have full control over the styling of your forms. You can apply your own CSS classes or use CSS-in-JS solutions to style the components as needed.
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
MIT © Skyleen77
FAQs
**TypedForm** is a lightweight, unstyled React component library for building forms with ease. It leverages [React Hook Form](https://react-hook-form.com/) for robust form state management and validation, ensuring your forms are well-structured, semantica
We found that typedform demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.