Adaptive Text Field

Adaptiveness

  • Android & iOS: native styling
  • AdaptiveSelect behavior when select={true}
import AdaptiveModeDemo from "@/shared/adaptiveModeDemo";
import { AdaptiveTextField } from "adaptive-material-ui/components/textField";

export default function () {
  return (
    <AdaptiveModeDemo>
      <AdaptiveTextField label="Text field" variant="standard" />
    </AdaptiveModeDemo>
  );
}

Variations

Variant
Color
Error
Select
Standard
Outlined
Filled
import AdaptiveModeDemo from "@/shared/adaptiveModeDemo";
import { DemoList, DemoListItem } from "@/shared/demoList";
import { AdaptiveSelectItem } from "adaptive-material-ui/components/select";
import { AdaptiveTextField } from "adaptive-material-ui/components/textField";

export default function () {
  return (
    <AdaptiveModeDemo>
      <DemoList>
        <DemoListItem title="Variant">
          <AdaptiveTextField
            label="Standard"
            variant="standard"
            sx={{ width: 100 }}
          />
          <AdaptiveTextField
            label="Outlined"
            variant="outlined"
            sx={{ width: 100 }}
          />
          <AdaptiveTextField
            label="Filled"
            variant="filled"
            sx={{ width: 100 }}
          />
        </DemoListItem>
        <DemoListItem title="Color">
          <AdaptiveTextField
            label="Primary"
            color="primary"
            sx={{ width: 100 }}
          />
          <AdaptiveTextField
            label="Secondary"
            color="secondary"
            sx={{ width: 100 }}
          />
          <AdaptiveTextField label="Info" color="info" sx={{ width: 100 }} />
          <AdaptiveTextField
            label="Success"
            color="success"
            sx={{ width: 100 }}
          />
          <AdaptiveTextField
            label="Warning"
            color="warning"
            sx={{ width: 100 }}
          />
          <AdaptiveTextField label="Error" color="error" sx={{ width: 100 }} />
        </DemoListItem>
        <DemoListItem title="Error">
          <AdaptiveTextField
            error
            label="Standard"
            variant="standard"
            sx={{ width: 100 }}
          />
          <AdaptiveTextField
            error
            label="Outlined"
            variant="outlined"
            sx={{ width: 100 }}
          />
          <AdaptiveTextField
            error
            label="Filled"
            variant="filled"
            sx={{ width: 100 }}
          />
        </DemoListItem>
        <DemoListItem title="Select">
          <AdaptiveTextField
            defaultValue={1}
            label="Standard"
            select
            variant="standard"
            sx={{ width: 100 }}
          >
            <AdaptiveSelectItem value={1}>One</AdaptiveSelectItem>
            <AdaptiveSelectItem value={2}>Two</AdaptiveSelectItem>
          </AdaptiveTextField>
          <AdaptiveTextField
            defaultValue={1}
            label="Outlined"
            select
            variant="outlined"
            sx={{ width: 100 }}
          >
            <AdaptiveSelectItem value={1}>One</AdaptiveSelectItem>
            <AdaptiveSelectItem value={2}>Two</AdaptiveSelectItem>
          </AdaptiveTextField>
          <AdaptiveTextField
            defaultValue={1}
            label="Filled"
            select
            variant="filled"
            sx={{ width: 100 }}
          >
            <AdaptiveSelectItem value={1}>One</AdaptiveSelectItem>
            <AdaptiveSelectItem value={2}>Two</AdaptiveSelectItem>
          </AdaptiveTextField>
        </DemoListItem>
      </DemoList>
    </AdaptiveModeDemo>
  );
}

API

MUI Text Field API with the following changes:

  • slots.input defaults to AdaptiveInput, AdaptiveFilledInput, or AdaptiveOutlinedInput
  • slots.select defaults to AdaptiveSelect
  • iOS: slotProps.inputLabel.focused defaults to false

AdaptiveInput

MUI Input API

AdaptiveFilledInput

MUI Filled Input API

AdaptiveOutlinedInput

MUI Outlined Input API