Auto-Grow Textarea
A multi-line `<textarea>` that grows with its content using `field-sizing: content` — no JS observer needed. Falls back to a min-height on browsers without support.
Auto-Grow Textarea the 22nd of 28 designs in the 28 CSS Input Field Designs collection. The design is implemented in pure CSS — no JavaScript required. Copy the HTML and CSS panels below into your project. Because the demo is pure CSS, it works in any framework or templating engine you happen to use. The design honours prefers-reduced-motion and uses real semantic markup, so it ships accessibility-ready out of the box.
Live preview
The code
<label class="if-grow"> <span class="if-grow-label">Notes</span> <textarea name="notes" rows="2" placeholder="Type as much as you need..."></textarea> <span class="if-grow-hint">Field grows as you type</span> </label>
.if-grow {
display: grid;
gap: 6px;
width: 100%;
max-width: 320px;
}
.if-grow-label {
font-family: "JetBrains Mono", monospace;
font-size: 10px;
letter-spacing: 0.12em;
color: #b8b6d4;
text-transform: uppercase;
}
.if-grow textarea {
width: 100%;
box-sizing: border-box;
padding: 12px 14px;
background: #1a1a22;
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 10px;
color: #f0eeff;
font:
500 14px/1.55 system-ui,
sans-serif;
outline: none;
resize: none;
min-height: 64px;
field-sizing: content;
transition:
border-color 0.2s,
background 0.2s;
}
.if-grow textarea:focus {
border-color: #a78bfa;
background: #1f1f2a;
}
.if-grow textarea::placeholder {
color: #b8b6d4;
}
.if-grow-hint {
font-size: 11px;
color: #b8b6d4;
}