npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

add-to-calendar-button-react

v2.6.14

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

45,309

Readme

Add to Calendar Button React Wrapper

Version Parent Script Version npm bundle size npm Installations

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.

Supported Calendars: Apple (via iCal), Google, Microsoft (365, Outlook, Teams), Yahoo, 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.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...