Form Wire
Integrations

Material UI

Use Form Wire with Material UI components

The @form-wire/mui package provides a ready-made muiMapper and createMuiMapper for Material UI.

Installation

bun add @form-wire/mui @mui/material @emotion/react @emotion/styled

Usage

"use client";

import { muiMapper } from "@form-wire/mui";
import { FormWireProvider } from "@form-wire/react";

export function Providers({ children }: { children: React.ReactNode }) {
  return <FormWireProvider mapper={muiMapper}>{children}</FormWireProvider>;
}

Or scope it to one generated form:

<Contact.Form mapper={muiMapper} action={submitContact} />

Component Overrides

import { TextField } from "@mui/material";
import { createMuiMapper, type MuiTextFieldProps } from "@form-wire/mui";

function AppTextField(props: MuiTextFieldProps) {
  return <TextField size="small" fullWidth {...props} />;
}

export const mapper = createMuiMapper({
  TextField: AppTextField,
});

Mapped Components

Form Wire keyMaterial UI component
stringTextField, with multiline for textarea fields
booleanCheckbox
selectSelect and MenuItem
fileTextField with type="file"
fieldFormControl, FormLabel, FormHelperText
groupNative fieldset
submitButton
statusSkeleton
messageAlert

The exported prop types are derived from MUI with ComponentProps<typeof MuiComponent>.

On this page