TextArea
ic.TextArea is a multi-line text field for collecting longer user input such as descriptions, comments, or notes. It supports validation with error messages, a character counter, configurable resize behavior, and an auto-resize mode that grows the field to fit its content. It fires ValueChanged on every keystroke and Submitted on Ctrl+Enter (or Cmd+Enter on macOS).
Variant and size
Variant controls the visual treatment of the field. primary draws a visible border that clearly delineates the input area, while secondary removes the border and uses a recessed background that sits more quietly in dense layouts. Size scales the font and padding together so the textarea stays proportional to surrounding UI.
Rows, resize, and auto-resize
Rows sets the initial visible height of the textarea in lines of text. Resize controls whether the user can manually drag the field larger: vertical (the default) only allows height changes, horizontal only width, both allows both, and none locks the size entirely. When AutoResize is enabled, the textarea grows automatically to fit its content and manual resizing is disabled.
Validation
Setting Invalid to true highlights the field with an error border and shows the ErrorMessage below it. When the field is valid, HelperText is displayed instead as a subtle hint. Only one message appears at a time, with the error always taking priority.
Character limit
MaxLength caps the number of characters the user can type, and ShowCounter displays a live count below the field. The counter turns red when the input reaches 90% of the limit so the user gets a visual warning before hitting the ceiling. Both must be set together for the counter to appear.
Disabled and readonly
Disabled blocks all interaction and greys the field out, while Readonly keeps the content selectable and copyable but prevents editing. Use readonly when you want to display a value the user might need to copy but should not change.
Programmatic text control
selectAll highlights all the text in the textarea, which is useful for “copy all” flows. clear empties the textarea and fires ValueChanged with an empty string.
Events
TextArea fires ValueChanged on every keystroke, carrying the current text in the payload. Submitted fires when the user presses Ctrl+Enter (Cmd+Enter on macOS), which is useful for “send” or “save” interactions without a separate button. In MATLAB, attach listeners with addlistener and read from evt.Data.value.
Custom styling
Every component exposes a .css property that lets you inject instance-level CSS directly from MATLAB. This example styles the textarea as a sticky note. On focus, the note “lifts” off the surface with a deeper shadow.
ta = ic.TextArea("Placeholder", "Jot it down...", "Size", "lg");
ta.Rows = 6;
% Warm sticky-note background with subtle paper shadow
ta.css.style(".ic-textarea__field", ...
"background_color", "#fef9c3", ...
"border", "1px solid #fde68a", ...
"border_radius", "2px", ...
"box_shadow", "2px 3px 8px rgba(0,0,0,0.10)", ...
"transform", "rotate(-1.2deg)");
% Handwritten feel with warm ink color
ta.css.style(".ic-textarea__input", ...
"font_family", "Georgia, serif", ...
"color", "#78350f", ...
"line_height", "1.7");linear-gradient, backdrop-filter, or newer color functions may not work everywhere. For reference, MATLAB R2024b uses Chromium 104.
Always test your custom styles in the MATLAB version you are targeting, and use canIuse to check compatibility of specific CSS features if you know the browser version MATLAB is using.
Use the Developer Tools component to inspect the DOM structure of each component and find the right selectors for styling.