Configuration
Configuration
You can configure your embed by setting different options.
In JavaScript you pass options as an object:
If you embed via HTML, you need to pass optinos as attributes with data-tf- prefix:
Available options
options is an object with optional properties:
Options in plain HTML embed
To embed via HTML without writing JavaScript code, use data-tf-widget="<form-id>" for widget embed. You can define options as data attributes with data-tf- prefix and dashes in name (eg. autoFocus becomes data-tf-auto-focus). For example:
To set different option types:
- set a boolean property to
trueby omitting attribute value, (eg.<div ... data-tf-disable-footer></div> - pass function name for callbacks, eg.
data-tf-on-ready="myReadyFunction"if this function is available on global scope (eg.window) - to pass
string[]use coma-separated string, eg.transitiveSearchParams: ['foo', 'bar']becomesdata-tf-transitive-search-params="foo,bar" - to pass
objectpass coma-separated key=value pairs, eg.hidden: { foo: "f", bar: "b" }becomesdata-tf-hidden="foo=f,bar=b"
Custom Launch Options
You can open modal embed types (all except widget) based on user actions.
Properties open and openValue define when to automatically open the typeform.
If you wish to prevent automatically re-opening the typeform you can set preventReOpenOnClose.
- on page load
open: 'load'openValueleave undefined (not used)
- when user tries to leave the page
open: 'exit'openValuespecify the sensitivity threshold- To detect user is trying to exit the page we detect upwards mouse movement in top part of the website. The threshold defines height of this area. Usefull when you have navigation in top part of your website and mouse movement in that area does not necessarily indicate exit intent.
- when a user scrolls the page
open: 'scroll'openValuepercentage of page scrolled (0 - 100) to open the form
- after time elapsed
open: 'time'openValuenumber of milliseconds to wait before opening the form
To open a typeform in popup 1 minute after the page is loaded you can use this JavaScript code:
Or in HTML:
You can read more about this feature in our Help Center.
Custom icon
Custom icon provided string supports:
- URL (used as an img src)
- Text and Emojis
- HTML Markup
Redirect Target
You can supply a target for typeform redirect (on submit or via ending). It works the same as target for anchor HTML element:
_parent(default), opens in parent page_selfopens in the same embedded iframe as your typeform_topopens in current browser tab (same as_parentunless there are multiple nested iframes)_blankopens in new tab, however it might be blocked by popup blockers.
⚠️ Warning: Target _blank is not working in Safari (both desktop and mobile) and triggers a popup warning in Chrome on Android. It works in Chrome and Firefox on desktop.
Chaining typeforms
You can chain multiple typeforms inside an embed. You need to setup a redirect to another typeform:
- make sure to use URL with
typeform.comdomain in case you have a custom domain set up - set
redirectTarget/data-tf-redirect-targetto_selfto make the redirect inside the embed iframe
When you chain multiple typeforms they will be all displayed inside the embed and all embed options and callbacks will be preserved.
You can use formId in the callback payload to identify which form is currently displayed.