@formfacade/embed-react

中文文档
1.1.2发布于 2024/11/08ISCESM + CJS零依赖近 30 天下载 2116

Elevate your Google Form's appearance to seamlessly align with your website's branding using Formfacade.

原始使用文档
文档目录7 节
  1. Description
  2. Features
  3. Table of Contents
  4. Installation
  5. Usage
  6. Example
  7. Support
Formfacade customzie logo

Customize the UI and embed Google Forms in React without the need for an Iframe.

License

Description

Use Formfacade to integrate Google Forms into your React app with a user interface that complements your website and gets rid of the Google Forms branding.

@formfacade:embed-react demo

Features

  • Tailored UI for seamless integration with Light and Dark backgrounds
  • Easily implement callback functions upon form submission
  • Embed scripts instead of iframes to make them easier to load and UI-friendly.

Table of Contents

Installation

  1. Download the FormFacade Plugin: Obtain the FormFacade plugin from the Google Workspace Marketplace.

  2. Access Google Forms: Open your Google Form

  3. Add the FormFacade Add-on:

    • Click on the 'Add-ons' button in Google Forms.
    • Choose 'Formfacade' from the list of available add-ons.
    • Select 'Embed in a web page'.
  4. Embedding the Form:

    • Upon clicking 'Embed', a dialog will appear asking, “Where do you want to embed this form?”
    • Choose "Embed in React App" for integration.
    • Retrieve the 'formfacadeURL' from this selection.
  5. Integrate with React App: Use the following npm command to install the required package for embedding the form within your React application:

npm i @formfacade/embed-react

For more detailed information, please visit How to embed Google Forms in your React app without an iframe?

Usage


import FormfacadeEmbed from "@formfacade/embed-react";

<FormfacadeEmbed
    formFacadeURL={formFacadeURL}
    onSubmitForm={onSubmitForm}
/>

PropTypeDefault ValueRequired/Optional
formFacadeURLStringRequiredRequired
onSubmitFormFunction() => console.log('Form Submitted');Optional
prefillFormFunctionNot specifiedOptional
onFormLoadFunction() => console.log('Form loaded');Optional
flushBooleanfalseOptional
  • formFacadeURL: URL of the Formfacade embedded Google Form. This is a required field.
  • onSubmitForm: Callback function triggered on form submission.
  • prefillForm: Function to prefill form data. It's optional.
  • onFormLoad: Function that can be invoked when a form is loaded. It's optional.
  • flush: Disables autosave.

Example

Edit embed-react


import React from "react";
import FormfacadeEmbed from "@formfacade/embed-react";

const FORMFACADE_URL = "https://formfacade.com/include/109671923741510513923/form/1FAIpQLSetAzIt89c0hBCWhI1AzUWRXDQ0VV1JAUph6i_3dvNpT-ZpqA/classic.js?div=ff-compose";


const App = () => {

  const prefillForm = () => {
    // Optional: Refer to the provided link to find the entry IDs for prefilling input fields: 
    // https://formfacade.com/website/does-formfacade-support-pre-filled-survey-links-like-native-google-forms-on-1FAIpQLSfGvg22V7Lzyw_5AEbKBSpklS_TMw6tKxcQiDqlC9KvfBVTgQ.html
    
    return {
      'entry.1297600622': '@formfacade/embed-react',
      'entry.813617742': `${new Date()}`
    };
  };

  const onSubmitForm = () => {
    // Add your specific form submission handling code below.
    console.log("----FORM SUBMITTED----");
  };

  const onFormLoad = () => {
    console.log("----FORM LOADED----");
  };



  return (
    <div className="App">
      <FormfacadeEmbed
        formFacadeURL={FORMFACADE_URL}

        // Optional: Callback function triggered on form submission. Remove if not required.
        onSubmitForm={onSubmitForm}

        // Optional: Function that can be invoked when a form is loaded. Remove if not required.
        onFormLoad={onFormLoad}
    
        // Optional: Use prefillForm to prefill form fields. See prefillForm function for details. Remove if not required.
        prefillForm={prefillForm}

        // Optional
        flush={true}
      />
    </div>
  );
};

export default App;


Support

For support, email [email protected]

版本与发布记录

@formfacade/embed-react 共发布 10 个版本,首次发布于 2024/02/02;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.2latest2024/11/082 年前
1.1.12024/11/082 年前
1.1.02024/11/072 年前
1.0.42024/04/162 年前
1.0.32024/04/162 年前
1.0.22024/04/162 年前

关于 @formfacade/embed-react 的常见问题

@formfacade/embed-react 是什么?

Elevate your Google Form's appearance to seamlessly align with your website's branding using Formfacade.

如何安装 @formfacade/embed-react?

在项目目录运行 npm install @formfacade/embed-react,或使用 pnpm add / yarn add / bun add。

@formfacade/embed-react 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/formfacade__embed-react 是否存在。

@formfacade/embed-react 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@formfacade/embed-react 可以商用吗?

@formfacade/embed-react 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@formfacade/embed-react 的下载量有多少?

根据 npm 官方下载统计,@formfacade/embed-react 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,116 次,日均约 71 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@formfacade/embed-react 还在维护吗?

最新版本 1.1.2 发布于 2024/11/08(2 年前);至今共发布 10 个版本,其中过去 12 个月发布了 0 个;首次发布于 2024/02/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。