TextArea
Reference
- The
TextAreacomponent is use for rendering a styled multi-line text input field. - It supports customization of dimensions, styles, and behavior.
Props
-
value- Type:
string - Description: The current value of the text area.
- Type:
-
onEdit- Type:
function - Description: Callback triggered when the text area's value changes.
- Type:
-
onFocusOut- Type:
function - Description: Callback triggered when the text area loses focus.
- Type:
-
rows- Type:
number - Description: Sets the number of visible rows in the text area.
- Type:
-
placeholder- Type:
string - Description: Placeholder text displayed when the text area is empty.
- Type:
-
disabled- Type:
boolean - Description: Disables the text area if
true.
- Type:
-
style- Type:
object - Description: Custom styles for the text area.
- Type:
-
height- Type:
number - Description: Sets the height of the text area in pixels.
- Type:
-
width- Type:
string - Default:
'100%' - Description: Sets the width of the text area.
- Type:
Usage Example
import { TextArea } from './TextArea';
function Example(pageContext) {
const { protrakComponents } = React.useContext(customWidgetContext);
const { TextArea } = protrakComponents;
return(
<TextArea
value="Sample text"
onEdit={(val) => console.log('Edited value:', val)}
rows={5}
placeholder="Enter your text here"
height={150}
width="80%"
/>
);
}
- This renders a text area with 5 rows, a height of 150px, and a width of 80%. It logs the edited value on change.