add-to-calendar-button-react
v2.7.3
Published
Convenient React wrapper for the add to calendar button snippet, which lets you reliably create beautiful buttons, where people can add events to their calendars.
Downloads
70,247
Readme
The Add to Calendar Button - optimized for React
This is a wrapper repository for the popular Add to Calendar Button, making it even more convenient, to create beautiful buttons in React, where people can add events to their calendars.
This is for everybody, who wants to include a button in their React application, which enables users to easily add a specific event to their calendars. The main goal of this repository is to keep this process as easy as possible at maximum compatibility. Simply define your button configuration and everything else is automatically generated by the script. Supporting calendars at Apple, Google, Microsoft (365, Outlook, Teams), Yahoo, and generic iCal.
In terms of system support, all modern browsers (Chrome, Edge, Firefox, Safari) on Windows, Mac, Android, and iOS as well as rather restricted webview environments like the Instagram in-app browser are supported.
▶️ Demo
See add-to-calendar-button.com for a live demo and more documentation.
✨ Features
Simple and convenient integration of 1 or many buttons, optimized to be used as a React component.
Supported Calendars
- Google Calendar.
- Yahoo Calender.
- Microsoft 365, Outlook, and Teams.
- Automatically generated iCal/ics files (for all other calendars, like Apple).
Event Types
- Timed and all-day events.
- One-time, multi-date, recurring.
- Calendar Subscription.
- Most robust time zone and daylight saving management (via our own TimeZones iCal Library).
- Dynamic dates (like "today + 3").
Look
- Beautiful and adjustable UI.
- Light and dark mode.
- Multiple themes.
Accessibility
- Optimized and adjustable UX (for desktop and mobile).
- Dynamic dropdown positioning.
- Taking care of all those edge cases, where some scenarios do not support specific setups (like WebView blocking downloads); utilizing beautiful user guidance workarounds.
- Auto-generated Schema.org rich (structured) data for better SEO.
- Full support for mouse, touch, or keyboard input (W3C WAI compliant).
- Supporting 20+ languages, incl. RTL text for Arabic; but also custom labels and text blocks.
And much more
- Well documented code, to easily understand the processes and build on top of it.
- No external module or backend dependencies.
- Fully GDPR, CCPA, and LGPD compliant by design - without the need of signing some data processing agreement.
- FREE and easy.
🚀 Go PRO
- ics file generation and hosting for better compatibility.
- RSVP, incl. automatic updates sent to attendees, GDPR features, and more.
- More customization - all no-code.
- API, webhooks, and more technical toys.
- Share events among all kinds of channels - email, social media, ...
Check the details at add-to-calendar-pro.com!
📦 Installation
Install the package using the following npm command:
npm install add-to-calendar-button-react
It requires React and React-Dom, both >=18.0.0. The installer will warn you automatically if your setup does not fit.
🎛️ Setup & Configuration
Import the component wherever you want to use it:
import { AddToCalendarButton } from 'add-to-calendar-button-react';
Mind that this package only works on the client side!
You should mark the component where you use it as use client
and/or make use of dynamic imports, where you set "ssr" to false (e.g. with Next.js).
Use the componet inside your code and declare any options as props. You will get warned about any type misconfiguration.
Calendar type options and time zone information are not required, but recommended.
<AddToCalendarButton
name="Test-Event"
startDate="2023-05-22"
options={['Apple','Google','Yahoo','iCal']}
timeZone="America/Los_Angeles"
></AddToCalendarButton>
If you need to use the type explicitely, you can import it via:
import type { AddToCalendarButtonType } from 'add-to-calendar-button-react';
When using the PRO version, you can keep it even shorter, as you would only need the proKey.
<AddToCalendarButton proKey="prokey-of-your-event"></AddToCalendarButton>
All options and hidden features
Find all information about the available props and how to configure specific features on the demo page at add-to-calendar-button.com/configuration.
Mind the difference to the web component! At this wrapper, you would use the <AddToCalendarButton>
component instead of the <add-to-calendar-button>
custom element.
Also mind that, different to the main package, with the React wrapper, you can actually declare arrays (like with the options prop) as arrays and objects (like with multi-date setups) as objects!
🤗 Support it!
You like this project? It would be awesome if you would support it, so it lives on!
- ⭐ Star the repository in order to stay up-to-date and save it for later!
- 📣 Spread the word! On Twitter/X, Medium, Discord, Facebook, ...
- ✍️ Leave a review at ProductHunt.
- 💌 Send us some positive feedback at the discussion board.
⚡ Changelog
- v2.7 : update to parent script v2.7; RSVP open seats, fixes
- v2.6 : update to parent script v2.6; useUserTZ, css ::part
- v2.5 : update to parent script v2.5; Introducing PRO, default branding, customLabels update, optionsMobile, dropdown for date style
- v2.4 : update to parent script v2.4; forceOverlay
- v2.3 : update to parent script v2.3; pastDateHandling, disabled option, static-dropup option, new languages
- v2.2 : update to parent script v2.2; type fixes; "attendee" option; better lazy load of external css
- v2.1 : update to parent script v2.1; type fixes
- v2.0 : supporting latest major version of the parent script
- v1.0 : initial release
(Only referring to this wrapper repository and not including any patches!)
Find all changes regarding the parent package at its CHANGELOG.md.
🙌 Contributing
Anyone is welcome to contribute, but mind the guidelines:
IMPORTANT NOTE: Run npm install
and npm run format
before you create any pull request!
📃 Copyright and License
Copyright (c) Jens Kuerschner.
Licensed under Elastic License 2.0 (ELv2).
About open-source: We consider ourselves open-source. However, we are also aware of the controversy coming with licenses like the one selected. Therefore, and contrary to many other companies and products, we no longer use the term in any marketing statements unless it is about other pieces which really are under an official OSI license.
Speaking about the license: We love it, because it is so simple. Have a look! You are basically free to do anything unless you are not offering the tool itself as a product or service; or want to remove copyright and license stuff. In doubt, simply ask and we find a way. :)
💜 Kudos go to
...all contributors and people involved! Thanks a lot!
Find more details at the respective parent repo section here...