--- title: Embed --- import Anchor from "../../components/Anchor" # Embed The Embed allows your website visitors to book a meeting with you directly from your website. ## Install on any website Install the following Vanilla JS Snippet to get embed to work on any website. After that you can choose any of the ways to show your Cal Link embedded on your website. ```html ``` ## Install with a Framework ### embed-react It provides a react component `` that can be used to show the embed inline at that place. ```bash yarn add @calcom/embed-react ``` ### Any XYZ Framework You can use Vanilla JS Snippet to install Popular ways in which you can embed on your website Assuming that you have followed the steps of installing and initializing the snippet, you can show the embed in following ways: ### Inline Show the embed inline inside a container element. It would take the width and height of the container element.
_Vanilla JS_ ```html *Sample sandbox* ```
####
_React_ ```jsx import Cal from "@calcom/embed-react"; const MyComponent = () => ( ); ``` *Sample sandbox*
### Popup on any existing element To show the embed as a popup on clicking an element, add `data-cal-link` attribute to the element.
Vanilla JS To show the embed as a popup on clicking an element, simply add `data-cal-link` attribute to the element. *Sample sandbox*
React ```jsx import "@calcom/embed-react"; const MyComponent = ()=> { return } ``` *Sample sandbox*
### Floating pop-up button ```html ``` *Sample sandbox* ## Supported Instructions Consider an instruction as a function with that name and that would be called with the given arguments. ### `inline` Appends embed inline as the child of the element. ```html ```` - `elementOrSelector` - Give it either a valid CSS selector or an HTMLElement instance directly - `calLink` - Cal Link that you want to embed e.g. john. Just give the username. No need to give the full URL [https://cal.com/john](). It makes it easy to configure the calendar host once and use as many links you want with just usernames ### `ui` Configure UI for embed. Make it look part of your webpage. ```html ``` - `styles` - It supports styling for `body` and `eventTypeListItem`. Right now we support just background on these two. ### preload Usage: If you want to open cal link on some action. Make it pop open instantly by preloading it. ```html ``` - `calLink` - Cal Link that you want to embed e.g. john. Just give the username. No need to give the full URL [https://cal.com/john]() ## Actions You can listen to an action that occurs in embedded cal link as follows. You can think of them as DOM events. We are avoiding the term "events" to not confuse it with Cal Events. ```html ``` Following are the list of supported actions. - | Action | Description | Properties | |----------------------|------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | eventTypeSelected | When user chooses an event-type from the listing. | eventType:object // Event Type that has been selected" | | bookingSuccessful | When the booking is successfully done. It might not be confirmed. | confirmed: boolean; //Whether confirmation from organizer is pending or not

eventType: "Object for Event Type that has been booked";

date: string; // Date of Event

duration: number; //Duration of booked Event

organizer: object //Organizer details like name, timezone, email | | linkReady | Tells that the link is ready to be shown now. | None | | linkFailed | Fired if link fails to load | code: number; // Error Code

msg: string; //Human Readable msg

data: object // More details to debug the error | | __iframeReady | It is fired when the embedded iframe is ready to communicate with parent snippet. This is mostly for internal use by Embed Snippet | None | | __windowLoadComplete | Tells that window load for iframe is complete | None | | __dimensionChanged | Tells that dimensions of the content inside the iframe changed. | iframeWidth:number, iframeHeight:number | _Actions that start with __ are internal._