File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
packages/react-core/src/components/TextArea Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ export interface TextAreaProps extends Omit<HTMLProps<HTMLTextAreaElement>, 'onC
3636 value ?: string | number ;
3737 /** A callback for when the text area value changes. */
3838 onChange ?: ( event : React . ChangeEvent < HTMLTextAreaElement > , value : string ) => void ;
39+ /** Callback function when text area is focused */
40+ onFocus ?: ( event ?: React . FocusEvent < HTMLTextAreaElement > ) => void ;
41+ /** Callback function when text area is blurred (focus leaves) */
42+ onBlur ?: ( event ?: React . FocusEvent < HTMLTextAreaElement > ) => void ;
3943 /** Sets the orientation to limit the resize to */
4044 resizeOrientation ?: 'horizontal' | 'vertical' | 'both' ;
4145 /** Custom flag to show that the text area requires an associated id or aria-label. */
@@ -114,6 +118,8 @@ class TextAreaBase extends React.Component<TextAreaProps> {
114118 autoResize,
115119 onChange,
116120 /* eslint-enable @typescript-eslint/no-unused-vars */
121+ onBlur,
122+ onFocus,
117123 ...props
118124 } = this . props ;
119125 const orientation = `resize${ capitalize ( resizeOrientation ) } ` as
@@ -136,6 +142,8 @@ class TextAreaBase extends React.Component<TextAreaProps> {
136142 >
137143 < textarea
138144 onChange = { this . handleChange }
145+ onFocus = { onFocus }
146+ onBlur = { onBlur }
139147 { ...( typeof this . props . defaultValue !== 'string' && { value } ) }
140148 aria-invalid = { validated === ValidatedOptions . error }
141149 required = { isRequired }
You can’t perform that action at this time.
0 commit comments