Smooth sailing for adding calendar event links in a Bootstrap style button or dropdown
- Install Calvin with
yarn
ornpm
- Import Calvin:
import calvin from 'calvin'
- Init Calvin:
calvin.init()
- Include an element or elements on the page with the class of
calvin
passing the event info through the following data attributes:data-title
: Event Titledata-description
(optional): Event Descriptiondata-start
: Start dateTime of Eventdata-end
: End dateTime of Eventdata-location
: Event locationdata-timezone
(optional): Timezone of the Eventdata-filename
(optional): Name for the event .ics file
- Celebrate!
The Calvin init method can take an options object for the following customizations:
linkTypes
Calvin can create links for different calendar types. linkTypes
takes and array of calendar types. These links can be reordered or removed. If there is only one item in this array, then a button will be generated. If is more than one item then they will be but into a dropdown menu.
Default: ['icalendar', 'google', 'outlook', 'outlookcom', 'yahoo']
buttonContent
The main Calivin.js button content can be customized with the buttonContent
option.
Default: Add To Calendar
bootstrapButtonColor
Calvin relies on Bootstrap and the button color can be customized with any of the Bootstrap Colors
Default: primary
includeIcons Calvin can include icons for each of the links types in the dropdown. These will be included by default.
Default: true
parentClass
Calvin looks for elements with a certain class. This defaults to 'calvin', but can be set to any other class with the parentClass
property.
Default: calvin
calvin.init({
bootstrapButtonColor: 'danger',
linkTypes: ['icalendar', 'google', 'outlookcom']
});
<div
class="calvin"
data-title="Event Title"
data-description="Event Description"
data-start="2020-11-01T09:00:00.000-07:00"
data-end="2020-11-01T10:01:00.000-07:00"
data-location="123 Fake St"
data-timezone="America/Los_Angeles"
data-filename="filename">
</div>