Textarea height option

Textarea height option

Loren MaxwellLoren Maxwell Posts: 464Questions: 113Answers: 10

Would be nice to be able to specify the default height of a textarea when the form is displayed.

Sometimes I want a rather small textarea, such as 5rem, and other times I want a rather large one, such as 20rem, depending on how much I want to encourage someone to write.

{
    type: 'textarea',
    label: 'Summary:',
    name: 'summary',
    height: '5rem',
    attr: {
        placeholder: 'Please enter a brief summary here (limit 255 characters)'
    }
},
{
    type: 'textarea',
    label: 'Description:',
    name: 'description',
    height: '20rem',
    attr: {
        placeholder: 'Please enter a full description here'
    }
}

This question has an accepted answers - jump to answer

Answers

  • Loren MaxwellLoren Maxwell Posts: 464Questions: 113Answers: 10

    Ah never mind -- I just realized there was a "rows" attribute I had overlooked.

    For anyone interested, this is the correct solution:

    {
        type: 'textarea',
        label: 'Summary:',
        name: 'summary',
        attr: {
            placeholder: 'Please enter a brief summary here (limit 255 characters)',
            rows: 5
        }
    },
    {
        type: 'textarea',
        label: 'Description:',
        name: 'description',
        attr: {
            placeholder: 'Please enter a full description here',
            rows: 20
        }
    }
    
  • allanallan Posts: 65,277Questions: 1Answers: 10,821 Site admin
    Answer ✓

    You can also use CSS to do it:

    div.DTE_Field textarea {
      height: 20rem;
    }
    

    Allan

Sign In or Register to comment.