react-icalendar-link
v3.0.2
Published
Ability to create link for downloading ics file
Downloads
27,631
Readme
react-icalendar-link
Ability to create link for downloading ics file
Install
npm install --save react-icalendar-link
Usage
import React from "react";
import ICalendarLink from "react-icalendar-link";
class App extends React.Component {
render() {
const event = {
title: "My Title",
description: "My Description",
startTime: "2018-10-07T10:30:00+10:00",
endTime: "2018-10-07T12:00:00+10:00",
location: "10 Carlotta St, Artarmon NSW 2064, Australia",
attendees: [
"Hello World <[email protected]>",
"Hey <[email protected]>",
]
}
return (
<ICalendarLink event={event}>
Add to Calendar
</ICalendarLink>;
);
}
}
Using Raw Content
Currently it provides very few fields. You can provide the raw content for the extra fields instead.
import React from "react";
import ICalendarLink from "react-icalendar-link";
class App extends React.Component {
render() {
const event = {
title: "My Title",
description: "My Description",
startTime: "2018-10-07T10:30:00+10:00",
location: "10 Carlotta St, Artarmon NSW 2064, Australia";
}
const rawContent = `ATTENDEE;CN="Cyrus Daboo";CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED:mailto:[email protected]
ATTENDEE;CN="Wilfredo Sanchez Vega";CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:[email protected]
ATTENDEE;CN="Bernard Desruisseaux";CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:[email protected]
ATTENDEE;CN="Mike Douglass";CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:[email protected]`;
return (
<ICalendarLink event={event} rawContent={rawContent}>
Add to Calendar
</ICalendarLink>;
);
}
}
License
MIT © josephj