Skip to content

Conversation

@rugoncalves
Copy link

@rugoncalves rugoncalves commented Feb 9, 2026

Issue number: resolves internal


What is the current behavior?

  • The height of the textarea would not correspond to the rows number, when it the row number was set to 1:
    image

  • Ionic theme specifics:

    • Some paddings and margins were inaccurate;
    • Some CSS selectors were being more generic than it should:
      • :host([auto-grow]) .textarea-wrapper-inner
        This selector was always being applied independently on the value of the attribute auto-grow;

What is the new behavior?

  • The min-height is now respecting the rows attribute:
    image

  • The ionic theme has the following changes:

    • .textarea-size-* classes stopped forcing the min-height;
    • textarea minimum height, is now equivalent to the number of rows plus half row.
      This will cause the last line to be partially visible;
    • Fixed selector :host([auto-grow]) .textarea-wrapper-inner, to be applied only when auto-grow = false;
    • Removed margin of the native textarea element, as the ionic theme adds padding, will make the textarea never overlaps the label;
    • Added a style inline setting up a CSS variable --host-rows in the host, so that the minimum height can be calculated in the element div[.textarea-wrapper-inner];

Does this introduce a breaking change?

  • Yes
  • No

Other information

@rugoncalves rugoncalves requested a review from a team as a code owner February 9, 2026 18:44
@vercel
Copy link

vercel bot commented Feb 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment Feb 11, 2026 6:56pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates ion-textarea styling so the control’s minimum height better matches the configured rows (especially for rows="1"), with additional Ionic-theme-specific selector and spacing fixes.

Changes:

  • Add a data-attr-rows attribute to the textarea inner wrapper to enable rows-based styling.
  • Update Ionic theme sizing/min-height behavior, plus tighten auto-grow selectors to exclude auto-grow="false".
  • Adjust Ionic theme textarea top margin behavior (and remove the old outline-only margin rule).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.

File Description
core/src/components/textarea/textarea.tsx Adds data-attr-rows on the wrapper for CSS-based rows sizing.
core/src/components/textarea/textarea.ionic.scss Reworks Ionic theme min-height logic, auto-grow selectors, and label-placement spacing.
core/src/components/textarea/textarea.ionic.outline.scss Removes outline-only textarea margin-top rule (spacing now handled elsewhere).
core/src/components/textarea/textarea.common.scss Adds rows-related min-height override for certain host/class combinations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

rugoncalves and others added 2 commits February 9, 2026 21:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Clamp the minimum value to 1 to prevent 0 or negative heights.
* Add 0.5 to show a half-line peek at the next row.
*/
--number-rows: calc(max(var(--host-rows, 1), 1) + 0.5);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to accomplish the styling without creating new CSS variables?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to use the approach of adding an attribute (data-attr-rows) to the element with the css class .textarea-wrapper-inner, and used in for the calculations in the way:

--root-rows = attr(data-attr-rows number);

But soon I discovered that attr() is not supported by all browsers.... namely safari.

The alternative is to generate selectors/classes for the number of supported rows (didn't sound too logical). Let me know your thoughts!

})}
// For ionic theme, we need to define this css variable
style={
theme === 'ionic' ? { '--host-rows': this.rows !== undefined ? this.rows.toString() : undefined } : undefined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to accomplish the styling without creating new CSS variables?

Copy link
Author

@rugoncalves rugoncalves Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#30950 (comment)

Answered above.

@rugoncalves rugoncalves changed the title style(textarea): adjusting min-height of the element feat(textarea): adjusting min-height of the textarea for ionic theme Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants