npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fillout/react

v1.1.2

Published

Embed Fillout forms in your React project

Downloads

5,996

Readme

Fillout React Embeds

Embed Fillout forms directly in your React project. TypeScript included, no dependencies :)

Setup

Install with npm i @fillout/react, and load the stylesheet with import "@fillout/react/style.css"

Embed components

There is a component for each embed type. All of them require the filloutId prop, which is the id of your form. This code is easy to spot in the url of the editor or the live form, for example, forms.fillout.com/t/foAdHjd1Duus.

All embed components allow you to pass URL parameters using the optional parameters prop, and you can also use inheritParameters to make the form inherit the parameters from the host page's url.

Standard embed

This one is pretty simple.

import { FilloutStandardEmbed } from "@fillout/react";
import "@fillout/react/style.css";

function App() {
  return (
    <div
      style={{
        width: 400,
        height: 400,
      }}
    >
      <FilloutStandardEmbed filloutId="foAdHjd1Duus" />
    </div>
  );
}

export default App;

If you'd rather not set the embed height manually and instead have it expand to the form size, use the dynamicResize prop.

FullScreen embed

The FilloutFullScreenEmbed component fills the entire page, with position: fixed.

import { FilloutFullScreenEmbed } from "@fillout/react";
import "@fillout/react/style.css";

function App() {
  return <FilloutFullScreenEmbed filloutId="foAdHjd1Duus" inheritParameters />;
}

export default App;

Popup embed

This component creates a popup, with a dark background covering the page content behind. Unlike the FullScreen embed, it can be closed using the close button or by clicking outside of the popup.

popup screenshot

You control it using your own state. An onClose prop is required, and should be used to unrender the popup.

import { FilloutPopupEmbed } from "@fillout/react";
import { useState } from "react";
import "@fillout/react/style.css";

function App() {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <>
      <button onClick={() => setIsOpen(true)}>Schedule a call</button>

      {isOpen && (
        <FilloutPopupEmbed
          filloutId="foAdHjd1Duus"
          onClose={() => setIsOpen(false)}
        />
      )}
    </>
  );
}

export default App;

Slider embed

Similar to the popup embed, this is intended to be rendered conditionally, and requires a function to be passed to the onClose prop. The form will slide out from the side of the screen. You can control which direction it comes from using sliderDirection, which can be left or right (default).

slider screenshot

import { FilloutSliderEmbed } from "@fillout/react";
import { useState } from "react";
import "@fillout/react/style.css";

function App() {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <>
      <button onClick={() => setIsOpen(true)}>Schedule a call</button>

      {isOpen && (
        <FilloutSliderEmbed
          filloutId="foAdHjd1Duus"
          inheritParameters
          parameters={{
            example: "abc",
          }}
          onClose={() => setIsOpen(false)}
          sliderDirection="left"
        />
      )}
    </>
  );
}

export default App;

Popup and Slider embed buttons

If you would prefer not to manage the open state of a popup or slider yourself, you can use FilloutPopupEmbedButton or FilloutSliderEmbedButton. This will render a button that opens the embed when clicked. These components take the same props as their standalone counterparts (except for onClose), but have some extra optional props to customize the button.

  • text - change the button text
  • color - change the button background color. the text color will automatically contrast with this as long as you specify a hex code.
  • size - small, medium or large
  • float - make your button float on the screen. bottomLeft or bottomRight.
import { FilloutSliderEmbedButton } from "@fillout/react";
import "@fillout/react/style.css";

function App() {
  return (
    <FilloutSliderEmbedButton
      filloutId="foAdHjd1Duus"
      inheritParameters
      parameters={{
        example: "abc",
      }}
      sliderDirection="left"
      text="Schedule a call"
      color="#444444"
      size="small"
      float="bottomRight"
    />
  );
}

export default App;

If you need greater control over the button appearance, you can just make your own and conditionally render the standalone embed components.

Custom domains

If you want to take advantage of features that are only available with forms hosted on your own domain, such as custom JS, you can use the domain prop to change the embedded url.

import { FilloutFullScreenEmbed } from "@fillout/react";
import "@fillout/react/style.css";

function App() {
  return (
    <FilloutFullScreenEmbed filloutId="foAdHjd1Duus" domain="example.com" />
  );
}

export default App;