@istebit/easyforms-react
v1.0.7
Published
Embeddable form player React component for EasyForms
Maintainers
Readme
@istebit/easyforms-react
Embeddable, fully customizable React form player for EasyForms. Features complete style isolation, responsive multi-page layouts, conditional logic, file uploads, Google OAuth sign-in verification, and zero style bleed into host applications.
Table of Contents
- Installation
- Quick Start
- Props Reference
- Layout & Container Customization
- Theme Customization Tokens
- 1. Global & Fonts
- 2. Header & Markdown Typography
- 3. Question Cards & Labels
- 4. Inputs, Textareas & Selects
- 5. Option Cards (Radio & Checkbox)
- 6. File Upload Dropzones
- 7. Section Headers & Multi-page Dividers
- 8. Buttons & Progress Indicators
- 9. Google Sign-In Button & Verified Badge
- 10. Success Submission State
- 11. Already Responded State
- 12. Error States
- Full Theme Configuration Example (Dark / Duotone)
- Supported Question Types
- Event Handlers & Callbacks
- Zero Style Bleed (CSS Isolation)
- License
Installation
# npm
npm install @istebit/easyforms-core @istebit/easyforms-react
# pnpm
pnpm add @istebit/easyforms-core @istebit/easyforms-react
# yarn
yarn add @istebit/easyforms-core @istebit/easyforms-reactQuick Start
"use client";
import React from "react";
import { EasyForm } from "@istebit/easyforms-react";
import "@istebit/easyforms-react/styles.css";
export default function App() {
return (
<EasyForm
formId="your_form_id_here"
apiKey="" //your-api-key
endpoint="https://your-easyforms-backend.com/api"
onSuccess={(data) => console.log("Submitted!", data)}
/>
);
}Props Reference
The <EasyForm /> (also exported as <FormPlayer />) component accepts the following props:
| Prop | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| formId (Required) | string | — | The EasyForms form ID (MongoDB ObjectId or slug). |
| apiKey | string | "" | Optional API key starting with ef_live_. |
| endpoint | string | "https://api.easyforms.com" | EasyForms API base URL (e.g. http://localhost:3001/api or production URL). |
| requireAuth | boolean | false | When true, requires Google One-Tap or Sign-In before responding. |
| googleClientId | string | undefined | Google OAuth 2.0 Web Client ID (required when requireAuth={true}). |
| showProgressBar | boolean | Form setting | Toggle progress bar visibility during multi-page or single-page navigation. |
| showBranding | boolean | false | Displays the "Powered by EasyForms" footer badge. |
| theme | ThemeOverrides | {} | 40+ color, typography, border, and state tokens (see Theme Customization Tokens). |
| layout | FormPlayerLayout| {} | Container geometry tokens (maxWidth, padding, margin, borderRadius). |
| className | string | "" | Additional CSS class for outer root wrapper. |
| containerClassName | string | "" | Additional CSS class applied to the main card container (e.g. Tailwind utility classes). |
| style | CSSProperties | {} | Inline CSS styles applied to the outer root wrapper. |
| containerStyle | CSSProperties | {} | Inline CSS styles applied to the inner form container. |
| onSuccess | (res: SubmissionResult) => void | — | Callback fired after a successful submission. |
| onError | (err: Error) => void | — | Callback fired when form fetch, validation, or submission fails. |
| onPageChange | (pageIndex: number) => void | — | Callback fired when navigating between multi-page sections. |
Layout & Container Customization
You can control form container dimensions and spacing via either layout props, containerClassName, or containerStyle:
<EasyForm
formId="6a6f3afb2cb2a05f24a4e754"
// 1. Via layout object:
layout={{
width: "100%",
maxWidth: "800px",
minWidth: "320px",
padding: "24px",
margin: "0 auto",
borderRadius: "16px",
}}
// 2. Or via Tailwind classes:
containerClassName="w-full max-w-3xl mx-auto p-6 md:p-8"
/>Theme Customization Tokens
EasyForms SDK supports over 40 distinct design tokens passed through the theme prop. All tokens dynamically map to isolated CSS variables and cascade through form sub-components.
1. Global & Fonts
| Token | Type | Description |
| :--- | :--- | :--- |
| primaryColor | string | Primary accent color (e.g. #ffffff or #3b82f6). |
| backgroundColor | string | Root background color behind form cards. |
| fontFamily | string | Primary font family (e.g. "Inter, sans-serif", "Plus Jakarta Sans"). |
| logoUrl | string | URL to custom brand logo shown at top of the form. |
| bannerUrl | string | URL to header banner image. |
| backgroundImageUrl| string | Full-screen background image URL. |
| brandName | string | Brand text displayed above the title. |
| brandTagline | string | Sub-tagline displayed under brand name. |
2. Header & Markdown Description Formatting
| Token | Type | Description |
| :--- | :--- | :--- |
| headerTitleColor | string | Form header title text color. |
| headerTitleFontSize | string | Header font size (e.g. "2rem", "28px"). |
| headerTitleFontFamily | string | Specific font family for the title. |
| headerDescriptionColor| string | Header description & markdown body text color. |
| headerDescriptionFontSize| string | Header description text size (e.g. "0.95rem"). |
| headerLinkColor | string | Color of links inside markdown descriptions. |
| headerLinkHoverColor | string | Hover color of markdown links. |
| markdownBoldColor | string | Text color of bold text (**bold** or __bold__) across header, question, and section descriptions. |
| markdownItalicColor | string | Text color of italic text (*italic* or _italic_). |
| markdownBoldItalicColor | string | Text color of bold & italic text (***both*** or **_both_**). |
| markdownCodeBackground | string | Background color for inline `code` snippets. |
| markdownCodeColor | string | Text color for inline `code` snippets. |
| markdownCodeBorderColor | string | Border color for inline `code` snippets. |
3. Question Cards & Labels
| Token | Type | Description |
| :--- | :--- | :--- |
| questionTitleColor | string | Question heading text color. |
| questionTitleFontSize | string | Question title font size (e.g. "1rem"). |
| questionTitleFontWeight| string | Question title font weight (e.g. "600"). |
| questionDescriptionColor| string | Helper/sub-description text color under questions. |
| questionDescriptionFontSize| string | Helper text font size (e.g. "0.875rem"). |
| questionNumberBg | string | Background color for question number badges (1, 2, 3). |
| questionNumberColor | string | Text color for question number badges. |
| requiredAsteriskColor | string | Color of the * symbol on mandatory fields. |
4. Inputs, Textareas & Selects
| Token | Type | Description |
| :--- | :--- | :--- |
| inputBackground | string | Background color for text fields, dropdowns, and date pickers. |
| inputTextColor | string | Text color inside input fields. |
| inputBorderColor | string | Border color for input fields. |
| inputPlaceholderColor | string | Placeholder text color. |
| inputFocusBorderColor | string | Border & outline color when an input is focused. |
| cardBackground | string | Background color for individual question cards. |
| cardBorderColor | string | Border color for question cards. |
| cardRadius | string | Rounded corners for cards (e.g. "0.75rem", "12px"). |
5. Option Cards (Radio & Checkbox)
| Token | Type | Description |
| :--- | :--- | :--- |
| optionBackground | string | Idle background color for selectable choices. |
| optionTextColor | string | Idle text color for choice labels. |
| optionBorderColor | string | Idle border color for choice cards. |
| optionHoverBackground | string | Hover background color (prevents dark mode flash). |
| optionHoverBorderColor| string | Hover border highlight color. |
| optionCheckedBackground| string| Background color when an option is selected/checked. |
| optionCheckedBorderColor| string| Border color when an option is selected/checked. |
| optionCheckedTextColor| string | Label text color when checked. |
6. File Upload Dropzones
| Token | Type | Description |
| :--- | :--- | :--- |
| uploadBackground | string | Background color of file upload drag-and-drop zone. |
| uploadBorderColor | string | Dashed border color of file upload zone. |
| uploadHoverBackground | string | Background color when dragging files or hovering. |
| uploadHoverBorderColor| string | Border highlight color when hovering dropzone. |
| uploadTextColor | string | File upload helper text and format information color. |
7. Section Headers & Multi-page Dividers
| Token | Type | Description |
| :--- | :--- | :--- |
| sectionHeaderBackground / sectionBackground | string | Background color for section divider banners. |
| sectionHeaderBorderColor / sectionBorderColor | string | Border color for section divider banners. |
| sectionHeaderTitleColor / sectionTitleColor | string | Title text color for section headers. |
| sectionHeaderTitleFontSize / sectionTitleFontSize | string | Font size for section title (e.g. "1.125rem"). |
| sectionHeaderDescriptionColor / sectionDescriptionColor | string | Description text color for section headers. |
| sectionHeaderDescriptionFontSize / sectionDescriptionFontSize | string | Font size for section description (e.g. "0.875rem"). |
| sectionHeaderRadius / sectionRadius | string | Border radius for section divider cards. |
| sectionDividerColor | string | Horizontal divider line color above form action buttons. |
8. Multi-page Step Indicators & Section Badges
| Token | Type | Description |
| :--- | :--- | :--- |
| stepActiveBackground | string | Background color for the currently active clickable step pill. |
| stepActiveBorderColor | string | Border color for the active step pill. |
| stepActiveTextColor | string | Text color for the active step title. |
| stepActiveNumberBackground | string | Background color for active step circle number (1, 2). |
| stepActiveNumberColor | string | Text color for active step circle number. |
| stepActiveRadius | string | Border radius for active step pill. |
| stepCompletedBackground | string | Background color for completed/passed step pills. |
| stepCompletedBorderColor | string | Border color for completed step pills. |
| stepCompletedTextColor | string | Text color for completed step titles. |
| stepCompletedNumberBackground | string | Background color for completed step circle numbers (renders checkmark icon). |
| stepCompletedNumberColor | string | Text color for completed step circle numbers. |
| stepCompletedRadius | string | Border radius for completed step pill. |
| stepInactiveBackground | string | Background color for upcoming/inactive step pills. |
| stepInactiveBorderColor | string | Border color for inactive step pills. |
| stepInactiveTextColor | string | Text color for inactive step titles. |
| stepInactiveNumberBackground | string | Background color for inactive step numbers. |
| stepInactiveNumberColor | string | Text color for inactive step numbers. |
| stepInactiveRadius | string | Border radius for inactive step pill. |
| stepConnectorColor | string | Line connector color between step pills. |
| stepBadgeBackground / sectionBadgeBackground | string | Background color for the "Section X of Y" header badge. |
| stepBadgeBorderColor / sectionBadgeBorderColor | string | Border color for the "Section X of Y" header badge. |
| stepBadgeTextColor / sectionBadgeTextColor | string | Text color for the "Section X of Y" header badge text. |
| stepBadgeCountColor / sectionBadgeCountColor | string | Text color for the count numbers (1, 2) inside the badge. |
| stepBadgeRadius / sectionBadgeRadius | string | Border radius for the section badge. |
| stepBadgeFontSize / sectionBadgeFontSize | string | Font size for the section badge. |
9. Buttons & Progress Indicators
| Token | Type | Description |
| :--- | :--- | :--- |
| buttonBackground | string | Background color for Next, Back, and Submit buttons. |
| buttonTextColor | string | Text color inside action buttons. |
| buttonHoverBackground| string | Hover background color for action buttons. |
| buttonRadius | string | Border radius for action buttons (e.g. "0.5rem"). |
| progressBarColor | string | Fill color for the multi-page progress bar. |
| progressBarTrackColor| string | Background track color of the progress bar. |
| ratingStarColor | string | Active filled star rating color. |
| ratingStarInactiveColor| string| Empty/unselected star rating color. |
10. Google Sign-In Button & Verified Badge
| Token | Type | Description |
| :--- | :--- | :--- |
| googleButtonBackground | string | Background of "Sign in with Google" button. |
| googleButtonTextColor | string | Text color of Google Sign-in button. |
| googleButtonBorderColor | string | Border color of Google Sign-in button. |
| googleButtonHoverBackground| string| Hover background of Google Sign-in button. |
| googleButtonRadius | string | Border radius of Google Sign-in button. |
| googleVerifiedBackground | string | Background of the verified user identity badge. |
| googleVerifiedBorderColor | string | Border color of the verified user identity badge. |
| googleVerifiedTextColor | string | "Signed in as" text color. |
| googleVerifiedEmailColor | string | Bold user email address color. |
| googleVerifiedShieldColor | string | Verified checkmark/shield icon color. |
10. Success Submission State
| Token | Type | Description |
| :--- | :--- | :--- |
| successCardBackground | string | Card background on successful form submission. |
| successCardBorderColor | string | Card border color on success. |
| successTitleColor | string | Headline text color on success. |
| successDescriptionColor | string | Body confirmation text color on success. |
| successIconColor | string | Checkmark celebration icon color. |
| successTitleText | string | Custom headline (e.g. "Registration Complete!"). |
| successDescriptionText | string | Custom body message override. |
11. Already Responded State
| Token | Type | Description |
| :--- | :--- | :--- |
| alreadyRespondedCardBackground | string | Card background when user already submitted. |
| alreadyRespondedCardBorderColor | string | Card border color. |
| alreadyRespondedTitleColor | string | Headline text color. |
| alreadyRespondedDescriptionColor| string | Subtitle text color. |
| alreadyRespondedIconColor | string | Information shield icon color. |
| alreadyRespondedTitleText | string | Custom headline override. |
| alreadyRespondedDescriptionText | string | Custom message text override. |
| switchAccountButtonBackground | string | Background color of "Switch Google Account" button. |
| switchAccountButtonTextColor | string | Text color of "Switch Google Account" button. |
12. Error States
| Token | Type | Description |
| :--- | :--- | :--- |
| errorCardBackground | string | Card background when form fails to load or submit. |
| errorCardBorderColor | string | Card border color on error. |
| errorTitleColor | string | Error headline text color. |
| errorDescriptionColor | string | Error message text color. |
| errorIconColor | string | Error alert icon color. |
Full Theme Configuration Example (Dark / Duotone)
Here is a full production example using high-contrast duotone styling:
import { EasyForm } from "@istebit/easyforms-react";
import "@istebit/easyforms-react/styles.css";
export function CustomForm() {
return (
<EasyForm
formId="your_form_id"
endpoint="https://api.yourdomain.com/api"
googleClientId="YOUR_GOOGLE_CLIENT_ID.apps.googleusercontent.com"
requireAuth={true}
showProgressBar={false}
containerClassName="w-full max-w-4xl mx-auto p-4"
theme={{
primaryColor: "#ffffff",
backgroundColor: "#000000",
fontFamily: "Inter, sans-serif",
headerTitleColor: "#ffffff",
headerTitleFontSize: "2rem",
headerDescriptionColor: "#a3a3a3",
headerLinkColor: "#ffffff",
markdownBoldColor: "#ffffff",
markdownItalicColor: "#d4d4d4",
markdownBoldItalicColor: "#ffffff",
markdownCodeBackground: "#181818",
markdownCodeColor: "#38bdf8",
// Multi-page Step Indicator & Badge
stepActiveBackground: "#171717",
stepActiveBorderColor: "#ffffff",
stepActiveTextColor: "#ffffff",
stepActiveNumberBackground: "#ffffff",
stepActiveNumberColor: "#000000",
stepActiveRadius: "0.375rem",
stepCompletedBackground: "#0d1f14",
stepCompletedBorderColor: "#10b981",
stepCompletedTextColor: "#10b981",
stepCompletedNumberBackground: "#10b981",
stepCompletedNumberColor: "#000000",
stepCompletedRadius: "0.375rem",
stepInactiveBackground: "#0d0d0d",
stepInactiveBorderColor: "#262626",
stepInactiveTextColor: "#737373",
stepInactiveNumberBackground: "#262626",
stepInactiveNumberColor: "#737373",
stepInactiveRadius: "0.375rem",
stepConnectorColor: "#262626",
// Section "1 of 2" Badge Button
stepBadgeBackground: "#141414",
stepBadgeBorderColor: "#262626",
stepBadgeTextColor: "#a3a3a3",
stepBadgeCountColor: "#ffffff",
stepBadgeRadius: "0.375rem",
// Section Divider Header
sectionHeaderBackground: "#0f0f0f",
sectionHeaderBorderColor: "#262626",
sectionHeaderTitleColor: "#ffffff",
sectionHeaderTitleFontSize: "1.125rem",
sectionHeaderDescriptionColor: "#a3a3a3",
sectionHeaderDescriptionFontSize: "0.875rem",
sectionHeaderRadius: "0.5rem",
sectionDividerColor: "#262626",
questionTitleColor: "#ffffff",
questionDescriptionColor: "#888888",
questionNumberBg: "#181818",
questionNumberColor: "#ffffff",
requiredAsteriskColor: "#ffffff",
inputBackground: "#0d0d0d",
inputTextColor: "#ffffff",
inputBorderColor: "#262626",
inputPlaceholderColor: "#525252",
inputFocusBorderColor: "#ffffff",
cardBackground: "#0a0a0a",
cardBorderColor: "#1f1f1f",
cardRadius: "0.75rem",
optionBackground: "#0d0d0d",
optionTextColor: "#ffffff",
optionBorderColor: "#262626",
optionHoverBackground: "#171717",
optionHoverBorderColor: "#404040",
optionCheckedBackground: "#1c1c1c",
optionCheckedBorderColor: "#ffffff",
optionCheckedTextColor: "#ffffff",
uploadBackground: "#0d0d0d",
uploadBorderColor: "#262626",
uploadHoverBackground: "#171717",
uploadHoverBorderColor: "#ffffff",
uploadTextColor: "#a3a3a3",
buttonBackground: "#ffffff",
buttonTextColor: "#000000",
buttonHoverBackground: "#e5e5e5",
googleButtonBackground: "rgba(255, 255, 255, 0.05)",
googleButtonBorderColor: "rgba(255, 255, 255, 0.15)",
googleButtonHoverBackground: "rgba(255, 255, 255, 0.1)",
googleButtonTextColor: "#ffffff",
successCardBackground: "#0a0a0a",
successCardBorderColor: "#262626",
successTitleColor: "#ffffff",
successTitleText: "Application Received!",
alreadyRespondedCardBackground: "#0a0a0a",
alreadyRespondedCardBorderColor: "#262626",
alreadyRespondedTitleColor: "#ffffff",
switchAccountButtonBackground: "#1a1a1a",
switchAccountButtonTextColor: "#ffffff",
errorCardBackground: "#0a0a0a",
errorCardBorderColor: "#331111",
errorIconColor: "#ff4444",
}}
onSuccess={(res) => console.log("Response ID:", res.id)}
onError={(err) => console.error("Error:", err.message)}
/>
);
}Supported Question Types
The SDK renders native, responsive widgets for all 12 EasyForms question types:
short_text— Single-line inputlong_text— Multi-line expanding textarea with character limitsmultiple_choice— Radio option cards with instant selectioncheckbox— Multi-select checkboxesdropdown— Styled select pickerrating— Interactive 1-5 or 1-10 star ratingdate— Native and custom date pickersemail— Email format validationnumber— Numeric constraints and stepperfile_upload— Direct-to-storage secure file drag-and-dropsection_break— Multi-page dividers with custom titles & descriptionsmultiple_choice_grid— Matrix/grid questions with criteria rows and columns
Event Handlers & Callbacks
<EasyForm
formId="form_123"
onPageChange={(pageIndex) => {
console.log("User navigated to step:", pageIndex + 1);
}}
onSuccess={(result) => {
console.log("Submission ID:", result.id);
console.log("Form ID:", result.formId);
console.log("Submitted At:", result.submittedAt);
}}
onError={(error) => {
console.error("Submission failed:", error.message);
}}
/>Zero Style Bleed (CSS Isolation)
The SDK stylesheet @istebit/easyforms-react/styles.css is built specifically for embedded applications:
- No Global Resets: Does not inject
@tailwind baseor preflight resets into your global<html>or<body>. - Strictly Scoped: Every CSS rule is scoped to
.ezf-root, guaranteeing that host styling (e.g. Next.js, Tailwind, Chakra UI, Bootstrap) remains untouched across route transitions.
License
MIT © ISTEBITS
