Files
react-test/docs/data/material/components/text-fields/InputWithIcon.tsx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.4 KiB
TypeScript
Raw Normal View History

2025-12-12 14:26:25 +09:00
import Box from '@mui/material/Box';
import Input from '@mui/material/Input';
import InputLabel from '@mui/material/InputLabel';
import InputAdornment from '@mui/material/InputAdornment';
import FormControl from '@mui/material/FormControl';
import TextField from '@mui/material/TextField';
import AccountCircle from '@mui/icons-material/AccountCircle';
export default function InputWithIcon() {
return (
<Box sx={{ '& > :not(style)': { m: 1 } }}>
<FormControl variant="standard">
<InputLabel htmlFor="input-with-icon-adornment">
With a start adornment
</InputLabel>
<Input
id="input-with-icon-adornment"
startAdornment={
<InputAdornment position="start">
<AccountCircle />
</InputAdornment>
}
/>
</FormControl>
<TextField
id="input-with-icon-textfield"
label="TextField"
slotProps={{
input: {
startAdornment: (
<InputAdornment position="start">
<AccountCircle />
</InputAdornment>
),
},
}}
variant="standard"
/>
<Box sx={{ display: 'flex', alignItems: 'flex-end' }}>
<AccountCircle sx={{ color: 'action.active', mr: 1, my: 0.5 }} />
<TextField id="input-with-sx" label="With sx" variant="standard" />
</Box>
</Box>
);
}