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 🙏

© 2026 – Pkg Stats / Ryan Hefner

formik-mui-fields

v0.4.0

Published

Formik-connected MUI form field components with automatic value, validation, and error handling

Downloads

825

Readme

formik-mui-fields

Formik-connected MUI form field components. Each component wraps an MUI input, wires it to Formik via useField, and automatically handles value binding, change/blur events, and validation error display.

Installation

This is a private internal package. Install peer dependencies in your consuming app:

npm install @mui/material formik react react-dom

Components

FormikTextField

Text input bound to Formik. Passes through all MUI TextFieldProps.

<FormikTextField name="email" label="Email" type="email" />

FormikSelect

Dropdown select with an options array. Passes through MUI SelectProps.

<FormikSelect
  name="country"
  label="Country"
  options={[
    { value: "us", label: "United States" },
    { value: "fr", label: "France" },
  ]}
/>

FormikAutocomplete

Generic autocomplete. Accepts a type parameter for option shape.

<FormikAutocomplete
  name="user"
  label="User"
  options={users}
  getOptionLabel={(u) => u.name}
  isOptionEqualToValue={(a, b) => a.id === b.id}
/>

FormikRadioGroup

Radio button group with an options array.

<FormikRadioGroup
  name="plan"
  label="Plan"
  options={[
    { value: "free", label: "Free" },
    { value: "pro", label: "Pro" },
  ]}
  row
/>

FormikCheckbox

Checkbox bound to a boolean Formik field. Passes through MUI CheckboxProps.

<FormikCheckbox name="agree" label="I agree to the terms" />

FormikSwitch

Toggle switch bound to a boolean Formik field. Passes through MUI SwitchProps.

<FormikSwitch name="notifications" label="Enable notifications" />

FormikSlider

Range slider. Passes through MUI SliderProps.

<FormikSlider name="volume" label="Volume" min={0} max={100} />

FormikRating

Star rating input. Passes through MUI RatingProps.

<FormikRating name="score" label="Rating" max={5} />

FormikToggleButtonGroup

Exclusive toggle button group with an options array. Passes through MUI ToggleButtonGroupProps.

<FormikToggleButtonGroup
  name="alignment"
  label="Text Alignment"
  options={[
    { value: "left", label: "Left" },
    { value: "center", label: "Center" },
    { value: "right", label: "Right" },
  ]}
  exclusive
/>

FormikColorPicker

Color picker using a circular swatch that opens a Chrome-style color picker (via react-color).

<FormikColorPicker name="brandColor" label="Brand Color" />

FormikFontPicker

Google Fonts autocomplete. Fetches font list from /api/google/fonts and injects a preview stylesheet for the selected font.

<FormikFontPicker name="fontFamily" label="Font" />

FormikNumberField

Numeric input that stores actual number values (not strings). Supports min, max, and step.

<FormikNumberField
  name="quantity"
  label="Quantity"
  min={1}
  max={100}
  step={1}
/>

FormikPasswordField

Password input with a show/hide visibility toggle. Accepts optional custom icons via visiblePasswordIcon and hiddenPasswordIcon.

<FormikPasswordField name="password" label="Password" />

FormikImageUpload

Drag-and-drop style image upload with optional cropping dialog. Supports configurable aspect ratios (1.91:1, 1:1, 3:1).

<FormikImageUpload name="avatar" label="Profile Picture" height={150} />;

{
  /* With cropping enabled */
}
<FormikImageUpload
  name="banner"
  label="Banner"
  cropEnabled
  cropOptions={["1.91:1", "1:1"]}
/>;

Date & Time Pickers

Imported separately from formik-mui-fields/date-picker. Requires @mui/x-date-pickers and dayjs as peer dependencies.

import {
  FormikDatePicker,
  FormikTimePicker,
  FormikDateTimePicker,
} from "formik-mui-fields/date-picker";

<FormikDatePicker name="date" label="Date" />
<FormikTimePicker name="time" label="Time" />
<FormikDateTimePicker name="datetime" label="Date & Time" />

Usage

All components are designed to be used inside a Formik <Form> or <Formik> context:

import { Formik, Form } from "formik";
import {
  FormikTextField,
  FormikSelect,
  FormikCheckbox,
} from "formik-mui-fields";

const MyForm = () => (
  <Formik
    initialValues={{ name: "", role: "", agree: false }}
    onSubmit={(values) => console.log(values)}
  >
    <Form>
      <FormikTextField name="name" label="Name" />
      <FormikSelect
        name="role"
        label="Role"
        options={[
          { value: "admin", label: "Admin" },
          { value: "user", label: "User" },
        ]}
      />
      <FormikCheckbox name="agree" label="I agree" />
      <button type="submit">Submit</button>
    </Form>
  </Formik>
);

Peer Dependencies

| Package | Version | Required | | --------------------- | ------- | ---------------------------------- | | @mui/material | >= 7 | Yes | | formik | >= 2 | Yes | | react | >= 18 | Yes | | react-dom | >= 18 | Yes | | @mui/x-date-pickers | >= 7 | Optional — for date/time pickers | | dayjs | >= 1 | Optional — for date/time pickers | | @mui/icons-material | >= 7 | Optional — for FormikPasswordField |