Add element inside TextField component - Material UI

You can do it this way: InputProps={{ endAdornment: <YourComponent /> }}

https://material-ui.com/api/input/


You can try this method, it worked for me :)

<TextField
  required
  id='password'
  label='Password'
  onChange={handleOnChange}
  type={toggle.passwordVisibility ? 'text' : 'password'}
  InputProps={{
    endAdornment: (
      <InputAdornment position='end'>
        <IconButton
          aria-label='toggle password visibility'
          onClick={handlePasswordVisibility}
          onMouseDown={handleMouseDownPassword}>
          {toggle.passwordVisibility && <Visibility />}
          {!toggle.passwordVisibility && <VisibilityOff />}
        </IconButton>
      </InputAdornment>
    ),
  }}
/>