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/styledUsage
"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 key | Material UI component |
|---|---|
string | TextField, with multiline for textarea fields |
boolean | Checkbox |
select | Select and MenuItem |
file | TextField with type="file" |
field | FormControl, FormLabel, FormHelperText |
group | Native fieldset |
submit | Button |
status | Skeleton |
message | Alert |
The exported prop types are derived from MUI with ComponentProps<typeof MuiComponent>.