Reputation: 97
Now my reactjs input field looked like this.
As you can see the text just keeps going straight and not moving down to the next line. How do I solve this? Here is my code for this input field.
<input className="bg-slate-50 text-main-blue border border-gray-300 drop-shadow-lg text-sm rounded-md my-5 block w-full p-2.5 whitespace-normal word-break:break-word" type="text" name="eventName" placeholder="Event Name" required onChange={event => setEventName(event.target.value)} value={eventName}/>
Upvotes: 4
Views: 3320
Reputation: 1
Not sure if you still need help, but incase anyone else needs help with this same issue later on and is hellbent on not using a div like I was, then use textarea to solve this issue. It functions just the same as an input, but the input tag isn't designed to support multi line input, whereas the textarea tag is designed for that.
Upvotes: 0
Reputation: 25070
word-break:break-word
to break-words
There is no class word-break:break-word
in tailwind-css
This is actually work of textarea
not text
, Use type = "textarea"
to get the desired result .
Use contenteditable
prop of div
and use break-words
property
<div class="m-4 max-w-full overflow-y-hidden break-words border border-solid border-black text-4xl" contenteditable="true"></div>
Tailwind Play
Upvotes: 4