1
0
pines/elements/textarea-auto-resize.html

14 lines
755 B
HTML
Raw Permalink Normal View History

<div class="w-full max-w-xs mx-auto">
<textarea x-data="{
resize () {
$el.style.height = '0px';
$el.style.height = $el.scrollHeight + 'px'
}
}"
x-init="resize()"
@input="resize()"
type="text"
placeholder="Type your message here. I will resize based on the height content."
class="flex w-full h-auto min-h-[80px] px-3 py-2 text-sm bg-white border rounded-md border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"
></textarea>
</div>