packageDocumentation module import classnames from "classnames" ; import * as React from "react" ; import { Textarea as ITwinUI_Textarea } from "@itwin/itwinui-react" ; import { useRefs } from "../utils/hooks/useRefs" ; import { CommonProps } from "../utils/Props" ; public deprecated export interface TextareaProps extends React . TextareaHTMLAttributes < HTMLTextAreaElement > , CommonProps { /** Number of textarea rows. Default is 3. */ rows ? : number ; /** Indicates whether to set focus to the textarea element */ setFocus ? : boolean ; /** Provides ability to return reference to HTMLInputElement */ ref ? : React . Ref < HTMLTextAreaElement > ; } const ForwardRefTextarea = React . forwardRef < HTMLTextAreaElement , TextareaProps > ( function ForwardRefTextarea ( props , ref ) { const { className , style , rows , setFocus , ... otherProps } = props ; const textRows = undefined !== rows ? rows : 3 ; const textAreaElementRef = React . useRef < HTMLTextAreaElement > ( ) ; const refs = useRefs ( textAreaElementRef , ref ) ; React . useEffect ( ( ) => { if ( textAreaElementRef . current && setFocus ) textAreaElementRef . current . focus ( ) ; } , [ setFocus ] ) ; const handleFocus = React . useCallback ( ( event ) => { event . currentTarget . select ( ) ; } , [ ] ) ; return ( < ITwinUI_Textarea { ... otherProps } ref = { refs } rows = { textRows } onFocus = { handleFocus } className = { classnames ( "uicore-inputs-textarea" , className ) } style = { style } / > ) ; } ) ; public deprecated export const Textarea = ForwardRefTextarea ;