floating labels do not work with dropdowns

hydeneil
Posts: 2
Joined: 28 Jan 2020, 17:28

13 Feb 2020, 16:38

AR7 wrote:
14 Jan 2020, 11:42
If someone is still blocked.
I solved this issue by adding a css class when my dropdown value is not null: [ngClass]="{'ddfilled': ddCivility.value != null}"
Seems to be a problem between the dropdown auto generated label tag with the selected value and the real label tag for the dropdown.

Hope I will help! ;)

In HTML :

Code: Select all

<span class="dd32 ui-float-label">
    <p-dropdown #ddCivility id="userDetailCivilities" placeholder=" " showClear="true" appendTo="body" [options]="civilities" [(ngModel)]="user.civility" [disabled]="isDisabled"></p-dropdown>
    <label for="userDetailCivilities" [ngClass]="{'ddfilled': ddCivility.value != null}">{{'users_civility' | translate}}</label>
</span>
In CSS :

Code: Select all

.ddfilled {
    top: -.75em;
    font-size: 12px;
}

WORKED FOR ME!!! Except I just put in "ui-inputwrapper-filled" instead of ddfilled and everything worked perfectly. Thanks so much!!

Post Reply

Return to “Ultima - PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest