Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
340 views
in Technique[技术] by (71.8m points)

javascript - Material UI - Show adornments vertically in TextField

I'm trying to show adornments vertically in material ui Textfield but no luck. It's always positioned horizontally. Is there a way to show adornments vertically?

Code:

<TextField 
   variant="filled" 
   fullWidth 
   multiline 
   rowsMax={7}
   onFocus={() => handleInputFocus({})}
   onBlur={() => handleInputFocus({})}
   InputProps={{
   ...(isSelected ? { endAdornment:
   <InputAdornment position="start">
      <Box mb={3}>
         <SaveIcon color="primary" className={cursorStyle} onClick={() => deleteNote()} />
         <DeleteIcon className={cursorStyle} onClick={() => deleteNote()} />
      </Box>
    </InputAdornment> }: {})
  }}
/>

Actual Output:

question from:https://stackoverflow.com/questions/65911540/material-ui-show-adornments-vertically-in-textfield

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use display flex, try to add style={{ display: 'flex', flexDirection: 'column'}} in InputAdornment line as <InputAdornment position="start" style={{ display: 'flex', flexDirection: 'column'}}>

Then just fix your icon's style. Because probably they will be out of the box boundaries.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...