Search code examples
javascriptvue.jsvuejs2vue-componentvuejs-datepicker

Unable to change width and height of vuejs-datepicker


I looked into this vuejs-datepicker to add datepicker to my project.

<div class="startDate">
    <datepicker
     v-model="startDate"
     format="YYYY-MM-DD"
     name="startDate"
     ></datepicker>
</div>

import datepicker from "vue-date-picker";

<style scoped>
  .startDate {
   width: 150px;
   }
<style>

But still width of startDate shows 238px which is default width of datepicker.


Solution

  • First of all remove scoped from style portion. And obtain classname by inspecting datepicker element.

    Here, in my case classname for startDate is .datetime-picker input[data-v-a46a390c]

    Now, apply to css like this:

    .datetime-picker input[data-v-a46a390c] {
      width: 150px;
      height: 38px;
    }