Browse components

FormControl

import FormControl from "@shpaw415/mui-lite/FormControl";
import InputLabel from "@shpaw415/mui-lite/InputLabel";
import { OutlinedInput } from "@shpaw415/mui-lite/Input";
import FormHelperText from "@shpaw415/mui-lite/FormHelperText";

Why use it

FormControl shares error, disabled, required, focused, and variant with labels, inputs, and helper text. Use it to build accessible fields that stay visually consistent without prop-drilling the same flags to every child.

Compose with InputLabel, Input / OutlinedInput / FilledInput, InputAdornment, and FormHelperText.

Demo

Outlined

We will never share your email.

Variants + error

Invalid value

Adornments
$

Example

import FormControl from "@shpaw415/mui-lite/FormControl";
import InputLabel from "@shpaw415/mui-lite/InputLabel";
import { OutlinedInput } from "@shpaw415/mui-lite/Input";
import InputAdornment from "@shpaw415/mui-lite/InputAdornment";
import FormHelperText from "@shpaw415/mui-lite/FormHelperText";
 
export function EmailField({ error }: { error?: string }) {
  return (
    <FormControl variant="outlined" error={Boolean(error)} fullWidth>
      <InputLabel>Email</InputLabel>
      <OutlinedInput
        type="email"
        startAdornment={<InputAdornment position="start">@</InputAdornment>}
      />
      <FormHelperText>{error || "We never share your email."}</FormHelperText>
    </FormControl>
  );
}

Props

PropTypeDefault
variantoutlined | filled | standardoutlined
error / disabled / requiredbooleanfalse
fullWidthbooleanfalse
marginnone | dense | normalnone
sizesmall | mediummedium