npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@trendcapital/react-hook-form-mantine

v4.1.13

Published

React hook form wrapper for Mantine components

Downloads

8,059

Readme

React-Hook-Form-Mantine

React-Hook-Form-Mantine is a library that simplifies the integration of Mantine components with React Hook Form. By adding a "name" prop to Mantine components, the library seamlessly connects them to the corresponding form field.

Getting Started

npm install @trendcapital/react-hook-form-mantine

Basic Usage

import { useForm } from "react-hook-form";
import { TextInput, NumberInput } from "@trendcapital/react-hook-form-mantine";

function MyForm() {
  const { control, handleSubmit } = useForm();

  const onSubmit = (data) => {
    console.log(data);
  };

  return (
    <FormProvider {...form}>
      <form onSubmit={handleSubmit(onSubmit)}>
        <TextInput name="username" label="Username" />
        <NumberInput name="age" label="Age" />
        <button type="submit">Submit</button>
      </form>
    </FormProvider>
  );
}

Optionally, without a FormProvider, you may pass the control prop:

import { useForm } from "react-hook-form";
import { TextInput, NumberInput } from "@trendcapital/react-hook-form-mantine";

function MyForm() {
  const { control, handleSubmit } = useForm();

  const onSubmit = (data) => {
    console.log(data);
  };

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <TextInput name="username" control={control} label="Username" />
      <NumberInput name="age" control={control} label="Age" />
      <button type="submit">Submit</button>
    </form>
  );
}

Input Name Assertion

import { useForm } from "react-hook-form";
import { TextInput, NumberInput } from "@trendcapital/react-hook-form-mantine";

const schema = z.object({
  username: z.string().min(2).max(100),
  age: z.number().min(0).max(120),
});

type TFormInputs = z.infer<typeof schema>;

function MyForm() {
  const { control, handleSubmit } = useForm<TFormInputs>({
    resolver: zodResolver(schema),
  });

  const onSubmit: SubmitHandler<TFormInputs> = (data) => {
    console.log(data);
  };

  return (
    <FormProvider {...form}>
      <form onSubmit={handleSubmit(onSubmit)}>
        <TextInput<TFormInputs> name="username" label="Username" />
        <NumberInput<TFormInputs> name="age" label="Age" />

        {/* This one will show an error on the name prop */}
        <TextInput<TFormInputs> name="email" label="Email" />

        <button type="submit">Submit</button>
      </form>
    </FormProvider>
  );
}

InputBase Component Polymorphism

import { useForm } from "react-hook-form";
import { TextInput, NumberInput } from "@trendcapital/react-hook-form-mantine";

const schema = z.object({
  agree: z.boolean(),
  age: z.number().min(0).max(120),
});

type TFormInputs = z.infer<typeof schema>;

function MyForm() {
  const { control, handleSubmit } = useForm<TFormInputs>({
    resolver: zodResolver(schema),
  });

  const onSubmit: SubmitHandler<TFormInputs> = (data) => {
    console.log(data);
  };

  return (
    <FormProvider {...form}>
      <form onSubmit={handleSubmit(onSubmit)}>
        {/* Defaults to "input" component type */}
        <InputBase<TFormInputs> name="age" label="Age" placeholder="Enter your age" type="number" />

        <InputBase<TFormInputs, 'button'> name="agree" onClick={() => {
          console.log('All button props are allowed on this component')
        }} />

        <button type="submit">Submit</button>
      </form>
    </FormProvider>
  );

Available Components

  • AngleSlider
  • Autocomplete
  • Checkbox
  • CheckBoxGroup
  • Chip
  • ChipGroup
  • ColorInput
  • ColorPicker
  • DateInput
  • DatePicker
  • DatePickerInput
  • DateTimePicker
  • FileInput
  • Input
  • InputBase (polymorphic component)
  • JsonInput
  • MiniCalendar
  • MonthPicker
  • MonthPickerInput
  • MultiSelect
  • NativeSelect
  • NumberInput
  • PasswordInput
  • PinInput
  • Radio
  • RadioGroup
  • Rating
  • SegmentedControl
  • Select
  • Slider
  • Switch
  • SwitchGroup
  • TagsInput
  • Textarea
  • TextInput
  • TimeGrid
  • TimeInput
  • TimePicker
  • YearPicker
  • YearPickerInput

Attribution

Huge shout-out to @aranlucas for the original idea and implementation of this library; however, since that project has largely gone unmaintained for two years, including all attempts to create pull-requests to update dependencies, I decided to fork the project and update things myself.

You can see the original project here: aranlucas/react-hook-form-mantine

License

MIT