0

I have website with user can choice date_range, so i use datepicker element-ui. But datepicker default theme, how i can change that in vue.

user8489678
  • 11
  • 1
  • 3

3 Answers3

1

At present, Element-UI doesn't provide the function of highly customized theme, only simple customized size and color.

However, you can customize the style with the following configuration:

popper-class - custom class name for DatePicker's dropdown

picker-options - You can set custom class name by creating a picker-options object with cellClassName property.

You can override the default style with a custom class.

Example:

// template
<el-date-picker v-model="value1"
                type="date"
                popper-class="custom-date-picker"
                placeholder="Pick a day">
</el-date-picker>
// css
.custom-date-picker{
  .el-date-picker__header{
    // custom header style here
  }
}
sugars
  • 1,473
  • 7
  • 17
0

this working for me, Element Plus with Vue 3!
In App.vue

<style lang="scss">
 .el-date-editor {
   --el-date-editor-width: 40% !important;
 }
</style>
john
  • 29
  • 1
  • 3
0

You need to just add style inside the tag like

<el-date-picker  v-model="value1"
            type="date"
            popper-class="custom-date-picker"
            placeholder="Pick a day"
       -->  style="width: 100%" />
  • Using inline CSS (`style` attribute) is considered [a bad practice](https://stackoverflow.com/questions/2612483/whats-so-bad-about-in-line-css). – xonya May 25 '22 at 20:00