{
  "id": "auto-resize-textarea",
  "name": "Auto-Resize Textarea",
  "category": "forms",
  "tags": [
    "textarea",
    "auto grow",
    "field-sizing",
    "comment box",
    "message",
    "resize"
  ],
  "description": "A textarea that grows with its content using field-sizing: content, capped at a max height, with no JavaScript.",
  "url": "https://copy-css.com/snippets/auto-resize-textarea",
  "markdown": "https://copy-css.com/snippets/auto-resize-textarea.md",
  "html": "<label class=\"grow-area\">\n  <span>Your message</span>\n  <textarea name=\"message\" rows=\"2\" placeholder=\"Type a few lines and watch me grow…\"></textarea>\n</label>",
  "css": ".grow-area {\n  display: grid;\n  gap: 6px;\n  width: 260px;\n  color: #0c4a6e;\n  font: 600 13px system-ui, sans-serif;\n}\n\n.grow-area textarea {\n  box-sizing: border-box;\n  width: 100%;\n  min-height: 3lh;\n  max-height: 8lh;\n  padding: 10px 12px;\n  border: 1.5px solid #bae6fd;\n  border-radius: 12px;\n  background: #fff;\n  color: #0f172a;\n  font: 400 15px/1.5 system-ui, sans-serif;\n  resize: vertical;\n  field-sizing: content;\n}\n\n.grow-area textarea:focus-visible {\n  border-color: #0284c7;\n  outline: none;\n  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);\n}\n\n@supports (field-sizing: content) {\n  .grow-area textarea {\n    resize: none;\n  }\n}",
  "features": [
    "field-sizing",
    "box shadows",
    "CSS Grid",
    "keyboard focus styles"
  ],
  "customProperties": []
}
