Vanilla Embed Library
The Vanilla Embed Library lets you embed typeforms directly into your website using pure JavaScript, without any framework dependencies. It works with any website or framework.
Installation
Via CDN (quickest method)
Add the script tag to your HTML:
Via NPM
For build-tool projects:
Then import in your JavaScript:
Embed types
Typeform offers four main embed types:
- Widget (Inline): Embedded directly in your page
- Popup: Opens in a modal overlay
- Slider: Slides in from the side
- Sidetab: Persistent tab on the side of the page
Widget (Inline) embed
Embed the form directly into your page content.
Basic implementation
With options
Popup embed
Display the form in a modal overlay.
Trigger on button click
Auto-open on page load
Auto-open with delay
Slider embed
Slide in from the right, left, top, or bottom of the screen.
Sidetab embed
Display a persistent tab that opens the form when clicked.
Configuration options
Common options (all embed types)
Widget-specific options
Popup-specific options
Slider-specific options
Sidetab-specific options
Methods
All embed types return methods for programmatic control:
Callbacks
onReady
Triggered when the form is fully loaded:
onSubmit
Triggered when the form is submitted:
onClose
Triggered when a popup/slider/sidetab is closed:
onQuestionChanged
Triggered when the respondent moves to a new question:
onHeightChanged
Triggered when the form height changes (useful for responsive iframes):
Complete example
Next steps
- Learn about inline embeds
- Explore modal embeds
- See full configuration options
- Check URL parameters for dynamic content
- Implement callbacks for tracking