# react-typeform-embed

> A React wrapper for [Typeform Embed SDK](https://developer.typeform.com/embed/).

Latest version **1.0.8** (published 2022-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-typeform-embed
pnpm add react-typeform-embed
yarn add react-typeform-embed
bun add react-typeform-embed
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2022-02-10 |
| First published | 2017-10-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 1 |
| Unpacked size | 22.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 125 |
| Author | Alex Garces |
| Maintainers | alexgrcs |
| Keywords | components, react, react-component, typeform |

## Links

- npm: https://www.npmjs.com/package/react-typeform-embed
- Repository: git@github.com:https://github.com/alexgarces/react-typeform-embed
- Homepage: http://alexgarces.github.io/react-typeform-embed/
- npm.io page: https://npm.io/package/react-typeform-embed

## Dependencies (1)

- [@typeform/embed](https://npm.io/package/@typeform/embed.md) ^1.28.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.8 (latest) — 2022-02-10
- 1.0.7 — 2021-09-15
- 1.0.5 — 2021-09-14
- 1.0.4 — 2021-09-14
- 1.0.3 — 2021-09-12
- 1.0.2 — 2021-09-12
- 1.0.1 — 2021-09-12
- 1.0.0 — 2021-09-11
- 0.2.1 — 2019-07-26
- 0.2.0 — 2019-01-13
- 0.1.6 — 2018-05-21
- 0.1.5 — 2018-04-17
- 0.1.4 — 2018-03-08
- 0.1.3 — 2017-11-04
- 0.1.2 — 2017-10-22
- … 2 more at https://npm.io/package/react-typeform-embed/versions

## README

# React Typeform Embed

A React wrapper for [Typeform Embed SDK](https://developer.typeform.com/embed/).

[See a live demo](https://alexgarces.github.io/react-typeform-embed/).

## Upgrading from [v.0.3](https://github.com/alexgarces/react-typeform-embed/tree/v0.3)

**Important:** Please be aware that if you are updating this package from a version previous to `v.1.0` you will need to apply changes in your implementation.

## Usage

First install the package

```bash
yarn add react-typeform-embed
```

There are [five different embed types](https://developer.typeform.com/embed/vanilla/#embed-types) that you can import as components.

- Widget
- Popup
- Slider
- Sidetab
- Popover

### Widget

With the **widget embed type** you can embed your form inline, in a DOM element.

```js
import { Widget } from 'react-typeform-embed';

const App = () => {
  render() {
    return <Widget id="njdbt5" height={500} />;
  }
}
```

### Popup and Slider

With the **popup and slider embed types** you can embed the form in a modal. You need to pass as children the element/s that will open the modal when clicked.

```js
import { Popup /* or Slider */ } from 'react-typeform-embed';

const App = () => {
  return (
    <Popup id="njdbt5" size={80}>
      <button>Open Popup</button>
    </Popup>
  );
}
```

### Sidetab and Popover

These other **modal embed types** work exactly as the Popup component but, since they are already visible and clickable, passing children element/s is optional.

```js
import { Sidetab /* or Popover */ } from 'react-typeform-embed';

const App = () => {
  return <Sidetab id="njdbt5">
}
```

[See the source](https://github.com/alexgarces/react-typeform-embed/tree/master/src/examples) for more examples.

## Configuration

You need to provide the **form id** as **id** prop.

You can get the id from the public URL of your form URL (`https://form.typeform.com/to/<form-id>`) or admin panel URL (`https://admin.typeform.com/form/<form-id>`).

You can also use any other option and callback from [the official SDK](https://developer.typeform.com/embed/) passing them as props. Find more info here:

- [Available Options](https://developer.typeform.com/embed/configuration/#available-options)
- [Callback Functions](https://developer.typeform.com/embed/callbacks/)

```js
<Widget
  id="your-form-id"
  height={400}
  opacity={80}
  hidden={{
    userId: 'hidden-user-id'
  }}
  onSubmit={() => {
    console.log('Form submitted!')
  }}
  hideHeaders
  disableAutoFocus
  enableSandbox
/>
```

## Demo

See a [live demo](https://alexgarces.github.io/react-typeform-embed/), or run:

```bash
git clone https://github.com/alexgarces/react-typeform-embed
cd react-typeform-embed
yarn
yarn start
open http://localhost:3000
```

## Alternatives

- Official [Typeform React Embed Library](https://github.com/Typeform/embed/tree/main/packages/embed-react)


### License

Code released under the [MIT license](LICENSE.txt).

---
_Source: https://npm.io/package/react-typeform-embed · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
