smelte icon indicating copy to clipboard operation
smelte copied to clipboard

`persistentHint` and `error` conflict on `TextField`

Open longrunningprocess opened this issue 4 years ago • 2 comments

Had to resort to this to make things work the way I think they should work by default:

  <TextField label="Enter text you would like translated..." 
             bind:value={translation} 
             textarea 
             rows="9" 
             outlined 
             max-length={MAX_LENGTH}
             hint={tooLong ? '' : `${remainingChars} characters remaining`}
             error={tooLong}
             required />

I would've preferred that persistentHint with a hint and an error would result in hint being hidden when error was true and the error being displayed. Would it be possible to have this behavior built in?

longrunningprocess avatar May 11 '20 19:05 longrunningprocess

  <TextField label="Enter text you would like translated..." 
             bind:value={translation} 
             textarea 
             rows="9" 
             outlined 
             max-length={MAX_LENGTH}
             hint="{remainingChars} characters remaining"
             persistentHint
             error={tooLong}
             required />

image

longrunningprocess avatar May 11 '20 20:05 longrunningprocess

  <TextField label="Enter text you would like translated..." 
             bind:value={translation} 
             textarea 
             rows="9" 
             outlined 
             max-length={MAX_LENGTH}
             hint="{remainingChars} characters remaining"
             persistentHint={true}
             error={tooLong}
             required />

image

longrunningprocess avatar May 11 '20 20:05 longrunningprocess