[Vuejs]-How can I change style of package v-calendar in Vue.js?

0๐Ÿ‘

If using vue-datepicker, you can change the CSS style adding this styles to your .css or in your view inside <style> ...</style>

Here an example of the elements. I already use it to change the input as Bootstrap style:

body {
  font-family: "Helvetica Neue Light", Helvetica, sans-serif;
  padding: 1em 2em 2em;
}
input,
select {
  padding: 0.75em 0.5em;
  font-size: 100%;
  border: 1px solid #ccc;
  width: 100%;
}

select {
  height: 2.5em;
}

.example {
  background: #f2f2f2;
  border: 1px solid #ddd;
  padding: 0em 1em 1em;
  margin-bottom: 2em;
}

code,
pre {
  margin: 1em 0;
  padding: 1em;
  border: 1px solid #bbb;
  display: block;
  background: #ddd;
  border-radius: 3px;
}

.settings {
  margin: 2em 0;
  border-top: 1px solid #bbb;
  background: #eee;
}

h5 {
  font-size: 100%;
  padding: 0;
}

.form-group {
  margin-bottom: 1em;
}

.form-group label {
  font-size: 80%;
  display: block;
}
๐Ÿ‘คguilieen

0๐Ÿ‘

    attrs: [
        {
          highlight: {
            style: {
              borderRadius: "6px",
              // border: '1px solid #1982EF',
              backgroundColor: "#ccd6e0b3",
            },
            contentStyle: {
              fontWeight: "700",
            },
          },
          dates: new Date(),
        },
        {
          dot: {
            style: {
              backgroundColor: "#53af52",
              marginBottom: "3px",
            },
          },
          dates: [],
        },
        {
          dot: {
            style: {
              backgroundColor: "#f2a000",
              marginBottom: "3px",
            },
          },
          dates: [],
        },
      ],

//these kind of style supported in v-calendar and we can use it like this.

๐Ÿ‘คTayyab AbbaXii

-1๐Ÿ‘

Place it in the template tag:

Place it in the script tag:

import Calendar from "v-calendar/lib/components/calendar.umd";

While assigning data variables:

attrs: [

    {
      highlight: {
        style: {
          borderRadius: '6px',
          border: '2px solid #1982EF'
        },
      },
      dates: new Date()
    },
    {
      dot: {
        style: {
          backgroundColor: '#53af52',
          marginBottom: '3px',
        },
      },
      dates: [],
    },
    {
      dot: {
        style: {
          backgroundColor: '#f2a000',
          marginBottom: '3px',
        },
      },
      excludeDates: null,
    },
    {
      content: {
        style: {
          display:'none !important'
        },
      },
      excludeDates: null,
    }
  ],

This attrs are passed to the v-calendar component as prop for handling style.

๐Ÿ‘คTayyab AbbaXii

Leave a comment