vue.jspasswordswidthprimevue

How do I modify the width of the password component in PrimeVue?


I am trying to override the default width of the Password component in PrimeVue but it didn't work.

**I have attempted to override the width using the following CSS: **

.p-password-input { width: 100% }

or

.p-password.has(.p-password-toggle-mask-icon) .p-password-input { width: 100% }


Solution

  • You can apply the width directly in the template using inline styles like this:

    <Password 
      v-model="password" 
      :feedback="false" 
      placeholder="Password" 
      :style="{ width: '100%' }" 
      :inputStyle="{ width: '100%' }" 
    />
    

    You can also set the width using CSS classes, like this:

    <Password 
      v-model="password" 
      :feedback="false" 
      placeholder="Password" 
      class="full-width" 
    />
    
    <style>
    .full-width {
      width: 100%;
    }
    
    .full-width .p-inputtext {
      width: 100%;
    }
    </style>