nextjs textarea resize none

nextjs

To prevent a textarea element from being resizable in a Next.js app, you can set the resize CSS property to none. This will disable the ability to resize the textarea element using the resize handle that appears in the bottom right corner of the element.

Here’s an example of how you can use the style prop to set the resize property:

import React from 'react'

function Example() {
    return (
        <textarea style={{resize: 'none'}}>
            This textarea cannot be resized.
        </textarea>
    )
}

Alternatively, you can use a CSS class to set the resize property. Here’s an example of how you can do this:

import React from 'react'

function Example() {
    return (
        <textarea className="no-resize">
            This textarea cannot be resized.
        </textarea>
    )
}

Then, in your CSS file, you can set the resize property for the no-resize class:

.no-resize {
    resize: none;
}

It’s important to note that the resize property is not supported in all browsers, so you may need to use a JavaScript solution to achieve the desired behavior if you need to support older browsers.