🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

@typeform/embed-react

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typeform/embed-react

Embed library for [React](https://reactjs.org/).

Source
npmnpm
Version
1.21.0
Version published
Weekly downloads
238K
18.7%
Maintainers
2
Weekly downloads
 
Created
Source

⚛ Typeform React Embed Library

Embed library for React.

Installation

Install as NPM package using your favourite package manager:

yarn add @typeform/embed-react

or

npm install --save @typeform/embed-react

Usage

Import the component you want to use. Then render it in your React app:

import { Widget } from '@typeform/embed-react'

const MyComponent = () => {
  return <Widget id="<form-id>" style={{ width: '50%' }} className="my-form" />
}

Popup and slider components provide a button to open the embed:

import { PopupButton } from '@typeform/embed-react'

const MyComponent = () => {
  return (
    <PopupButton id="<form-id>" style={{ fontSize: 20 }} className="my-button">
      click to open form in popup
    </PopupButton>
  )
}

You can render popover and slider anywhere in your app (preferably at the end of the page):

import { Sidetab } from '@typeform/embed-react'

const MyComponent = () => {
  return <Sidetab id="<form-id>" buttonText="click to open" />
}

How to get form id of your form?

You can find <form-id> from the public URL of your form:

  • https://form.typeform.com/to/<form-id>

Or from admin panel URL:

  • https://admin.typeform.com/form/<form-id>/*

Configuration

Options

Pass options as props to the component.

<PopupButton
  id="<form-id>"
  size={60}
  hidden={{
    foo: 'Foo Value',
    bar: 'Bar Value',
  }}
  onReady={() => {
    console.log('form ready')
  }}
  enableSandbox
>
  click to open
</PopupButton>

See all available options in Vanilla JavaScript Embed Library README file.

CSP nonce support

If the global __webpack_nonce__ is set, its value will be used for a nonce attribute on the inline <style> block. See #458 for details.

Examples

You can find examples for specific use-cases with React in our demos:

Local setup and development

Fork and clone this Github repo: https://github.com/Typeform/embed

Requirements:

  • node >= 12
  • yarn

Install dependencies:

yarn

We recommend you work in a branch:

git checkout -b cool-new-feature

Build, watch for changes (in both @typeform/embed and @typeform/embed-react packages) and start a demo server too (using demo-nextjs):

yarn demo

Build and watch for changes (in @typeform/embed-react only):

yarn dev

Run unit tests:

yarn test

See details on contributing to this repo.

Keywords

typeform

FAQs

Package last updated on 16 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts