Skip to content

bug: ion-label does not render when binding innerHTML directly #31433

Open

Description

@bohndickii

Prerequisites

Ionic Framework Version

v9.x, v8.x

Current Behavior

When binding innerHTML directly to ion-label it does not get rendered.

Expected Behavior

When binding innerHTML directly to ion-label it should be rendered.

Steps to Reproduce

<ion-label [innerHTML]="labelText">

Code Reproduction URL

https://stackblitz.com/edit/mchyfkqo?file=src%2Fapp%2Fexample.component.ts,src%2Fapp%2Fexample.component.html

Ionic Info

However, wrapping the same content inside a native element works correctly:

Additional Information

No response

Activity

  1. thetaPC commented on Oct 22, 2026

    @thetaPC
    Contributor

    Thanks for the report, and sorry for the delay.

    Verified on 9.0.9. ion-label is a scoped component, so Stencil, the library Ionic components are built with, keeps an internal marker inside the element to track where its content goes. Angular's [innerHTML] binding replaces every child of ion-label, including that marker, and on its next render Stencil hides any content it cannot place, which leaves the label empty. Setting the content later does not avoid it either: it disappears the next time the label re-renders, for example when its color changes. Bypassing Angular's sanitizer, suggested on earlier reports, does not help, since plain text disappears the same way.

    Workarounds, both verified on 9.0.9:

    • Bind innerHTML to an element inside the label instead of the label itself:
    <ion-item>
      <ion-label>
        <span [innerHTML]="labelText"></span>
      </ion-label>
    </ion-item>
    • For plain text with no markup, bind [textContent]="labelText" on the ion-label.

    The fix belongs in Stencil's runtime, so we have reported it upstream in stenciljs/core#6972. We are keeping this issue open to track the fix in Ionic.

  2. added
    type: buga confirmed bug report
    stencilIssues that require changes in Stencil
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: core@ionic/core packagestencilIssues that require changes in Stenciltype: buga confirmed bug report

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions