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 🙏

© 2024 – Pkg Stats / Ryan Hefner

formik-mantine

v0.15.0

Published

Dead simple declarative bindings for Formik and Mantine.

Downloads

218

Readme

Build Status npm license GitHub package.json version npm

Codesandbox example: https://codesandbox.io/s/formik-mantine-showroom-46h1jx

Simple declarative bindings for Mantine and Formik.

Getting started

npm install formik-mantine

Example

import React from "react"
import { NotificationsProvider } from "@mantine/notifications"
import {
  TextInput,
  Textarea,
  PasswordInput,
  Input,
  Checkbox,
  Switch,
  NumberInput,
  Slider,
  Select,
  RadioGroup,
  Chips,
  MultiSelect,
  SubmitButton,
} from "formik-mantine"
import { Radio, Chip } from "@mantine/core"
import { Formik } from "formik"

function App() {
  return (
    <NotificationsProvider>
      <Formik
        initialValues={{
          // default form values
          value1: "hello",
          value2: true,
          value3: 5,
          value4: null,
          value5: ["react", "svelte", "vue"],
        }}
        onSubmit={(values) => {
          console.log({ values })
          showNotification({
            title: "Submit",
            message: <pre>{JSON.stringify(values)}</pre>,
          })
        }}
      >
        <form>
          <TextInput label="TextInput" name="value1" />
          <Textarea label="Textarea" name="value1" />
          <PasswordInput label="PasswordInput" name="value1" />
          <Input name="value1" />
          <Checkbox name="value2" />
          <Switch name="value2" />
          <NumberInput name="value3" label="NumberInput" />
          <Slider name="value3" label="Slider" />
          <Select
            name="value4"
            label="Select (value4)"
            data={["val1", "val2", "val3"]}
          />
          <RadioGroup name="value4" label="RadioGroup (value4)">
            <Radio value="val1" label="val1" />
            <Radio value="val2" label="val2" />
            <Radio value="val3" label="val3" />
          </RadioGroup>
          <Chips name="value4">
            <Chip value="val1">val1</Chip>
            <Chip value="val2">val2</Chip>
            <Chip value="val3">val3</Chip>
          </Chips>
          <MultiSelect
            name="value5"
            label="MultiSelect (value5)"
            data={["val1", "val2", "val3", "react", "svelte", "vue"]}
          />
          <Chips name="value5" multiple={true}>
            {["val1", "val2", "val3", "react", "svelte", "vue"].map((v) => (
              <Chip key={v} value={v}>
                {v}
              </Chip>
            ))}
          </Chips>
          <SubmitButton>Submit</SubmitButton>
        </form>
      </Formik>
    </NotificationsProvider>
  )
}

Core Concept

This library enriches several Mantine components with a required name: string prop that connects them to a Formik form field. It is quite simple. Instead of importing your form components from Mantine, you need to import them from 'formik-mantine' and set their name prop. Now the component is connected/synced with the corresponding Formik field!

Otherwise the original api and functionality of the components stay the same.