The counter and counterFormatter properties on ion-item were deprecated in Ionic 7 and should be used directly on ion-input instead.
Inputs with a counter add a border between the input and the counter, therefore they should not be placed inside of an ion-item which adds an additional border under the item. The ion-padding-start class can be added to align the counter inputs with inputs inside of items.
<!-- Label and Label Position --> <!-- Before --> <ion-item> <ion-labelposition="floating">Email:</ion-label> <ion-input></ion-input> </ion-item> <!-- After --> <ion-item> <ion-inputlabel="Email:"label-placement="floating"></ion-input> </ion-item> <!-- Fill --> <!-- Before --> <ion-itemfill="outline"shape="round"> <ion-labelposition="floating">Email:</ion-label> <ion-input></ion-input> </ion-item> <!-- After --> <!-- Inputs using `fill` should not be placed in ion-item --> <ion-inputfill="outline"shape="round"label="Email:"label-placement="floating"></ion-input> <!-- Input-specific features on ion-item --> <!-- Before --> <ion-itemcounter="true"> <ion-labelposition="floating">Email:</ion-label> <ion-inputmaxlength="100"></ion-input> <divslot="helper">Enter an email</div> <divslot="error">Please enter a valid email</div> </ion-item> <!-- After --> <!-- Metadata such as counters and helper text should not be used when an input is in an item/list. If you need to provide more context on a input, consider using an ion-note underneath the ion-list. --> <ion-input label="Email:" counter="true" maxlength="100" helper-text="Enter an email" error-text="Please enter a valid email" ></ion-input>
<!-- Label and Label Position --> <!-- Before --> <ion-item> <ion-labelposition="floating">Email:</ion-label> <ion-input></ion-input> </ion-item> <!-- After --> <ion-item> <ion-inputlabel="Email:"labelPlacement="floating"></ion-input> </ion-item> <!-- Fill --> <!-- Before --> <ion-itemfill="outline"shape="round"> <ion-labelposition="floating">Email:</ion-label> <ion-input></ion-input> </ion-item> <!-- After --> <!-- Inputs using `fill` should not be placed in ion-item --> <ion-inputfill="outline"shape="round"label="Email:"labelPlacement="floating"></ion-input> <!-- Input-specific features on ion-item --> <!-- Before --> <ion-item[counter]="true"> <ion-labelposition="floating">Email:</ion-label> <ion-inputmaxlength="100"></ion-input> <divslot="helper">Enter an email</div> <divslot="error">Please enter a valid email</div> </ion-item> <!-- After --> <!-- Metadata such as counters and helper text should not be used when an input is in an item/list. If you need to provide more context on a input, consider using an ion-note underneath the ion-list. --> <ion-input label="Email:" [counter]="true" maxlength="100" helperText="Enter an email" errorText="Please enter a valid email" ></ion-input>
{/* Label and Label Position */} {/* Before */} <IonItem> <IonLabelposition="floating">Email:</IonLabel> <IonInput></IonInput> </IonItem> {/* After */} <IonItem> <IonInputlabel="Email:"labelPlacement="floating"></IonInput> </IonItem> {/* Fill */} {/* Before */} <IonItemfill="outline"shape="round"> <IonLabelposition="floating">Email:</IonLabel> <IonInput></IonInput> </IonItem> {/* After */} {/* Inputs using `fill` should not be placed in IonItem */} <IonInputfill="outline"shape="round"label="Email:"labelPlacement="floating"></IonInput> {/* Input-specific features on IonItem */} {/* Before */} <IonItemcounter={true}> <IonLabelposition="floating">Email:</IonLabel> <IonInputmaxlength="100"></IonInput> <divslot="helper">Enter an email</div> <divslot="error">Please enter a valid email</div> </IonItem> {/* After */} {/* Metadata such as counters and helper text should not be used when an input is in an item/list. If you need to provide more context on a input, consider using an IonNote underneath the IonList. */} <IonInput label="Email:" counter={true} maxlength="100" helperText="Enter an email" errorText="Please enter a valid email" ></IonInput>
<!-- Label and Label Position --> <!-- Before --> <ion-item> <ion-labelposition="floating">Email:</ion-label> <ion-input></ion-input> </ion-item> <!-- After --> <ion-item> <ion-inputlabel="Email:"label-placement="floating"></ion-input> </ion-item> <!-- Fill --> <!-- Before --> <ion-itemfill="outline"shape="round"> <ion-labelposition="floating">Email:</ion-label> <ion-input></ion-input> </ion-item> <!-- After --> <!-- Inputs using `fill` should not be placed in ion-item --> <ion-inputfill="outline"shape="round"label="Email:"label-placement="floating"></ion-input> <!-- Input-specific features on ion-item --> <!-- Before --> <ion-item:counter="true"> <ion-labelposition="floating">Email:</ion-label> <ion-inputmaxlength="100"></ion-input> <divslot="helper">Enter an email</div> <divslot="error">Please enter a valid email</div> </ion-item> <!-- After --> <!-- Metadata such as counters and helper text should not be used when an input is in an item/list. If you need to provide more context on a input, consider using an ion-note underneath the ion-list. --> <ion-input label="Email:" :counter="true" maxlength="100" helper-text="Enter an email" error-text="Please enter a valid email" ></ion-input>