Quick Start
Add a FileGrab form to any website with two lines of HTML. No backend, no API keys, no build step required.
<div id="filegrab-form"></div>
<script src="https://filegrab.link/widget/filegrab-widget.umd.js"></script>
<script>
FileGrabWidget.form({
formId: 'YOUR_FORM_ID',
container: '#filegrab-form',
});
</script>
Replace YOUR_FORM_ID with the ID from your form's settings panel.
The form renders inside an iframe with full CSS isolation, so your site's
styles won't conflict with the form and vice versa.
Colors
Pass a theme object to override the default colors. All color
values should be valid CSS colors (hex, rgb, hsl).
<script>
FileGrabWidget.form({
formId: 'YOUR_FORM_ID',
container: '#filegrab-form',
theme: {
primaryColor: '#0d9488',
backgroundColor: 'transparent',
textColor: '#1a2e35',
},
});
</script> | Property | Type | Description |
|---|---|---|
primaryColor | string | Accent color for the submit button, focus rings, and active states. Default: #F97316 (orange). |
backgroundColor | string | Form card background. Use 'transparent' to inherit the host page's background. Default: white. |
textColor | string | Primary text color for labels, inputs, and descriptions. Default: near-black. |
Fonts
Load custom fonts inside the embedded form's iframe. Use fontCssUrl
to point to a stylesheet (like Google Fonts), then set fontFamily
and headingFontFamily.
<script>
FileGrabWidget.form({
formId: 'YOUR_FORM_ID',
container: '#filegrab-form',
theme: {
fontCssUrl: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap',
fontFamily: "'Inter', sans-serif",
headingFontFamily: "'Inter', sans-serif",
},
});
</script> | Property | Type | Description |
|---|---|---|
fontFamily | string | CSS font-family for body text, labels, and inputs. |
headingFontFamily | string | CSS font-family for the form title. |
fontCssUrl | string | HTTPS URL to a font stylesheet. Loaded inside the iframe before the form renders. |
Since the form renders in an iframe, fonts loaded on your host page are not
automatically available inside the form. You must provide fontCssUrl
so the iframe loads the fonts independently.
Spacing & Layout
Control the spacing, padding, and sizing of form elements to match your site's design language.
<script>
FileGrabWidget.form({
formId: 'YOUR_FORM_ID',
container: '#filegrab-form',
theme: {
borderRadius: '8px',
inputPadding: '16px 24px',
fieldGap: '32px',
labelFontWeight: '600',
labelFontSize: '15px',
inputFontSize: '16px',
},
});
</script> | Property | Type | Description |
|---|---|---|
borderRadius | string | Border radius for the form card and input controls. Default: 10px. |
inputPadding | string | CSS padding for text inputs, selects, and textareas. Example: '14px 16px'. |
fieldGap | string | Vertical gap between form fields. Example: '24px'. |
labelFontWeight | string | Font weight for field labels. Example: '600' for semi-bold. |
labelFontSize | string | Font size for field labels. Example: '15px'. |
inputFontSize | string | Font size for input controls. Example: '16px'. |
Form Title
Control the font size of the form title heading to match your site's
heading scale. Accepts any CSS font-size value including clamp()
for responsive sizing.
<script>
FileGrabWidget.form({
formId: 'YOUR_FORM_ID',
container: '#filegrab-form',
theme: {
titleFontSize: 'clamp(1.75rem, 3vw, 2.25rem)',
},
});
</script> | Property | Type | Description |
|---|---|---|
titleFontSize | string | Font size for the form title. Example: '2rem' or 'clamp(1.75rem, 3vw, 2.25rem)'. Default: 1.5rem. |
The title font family is controlled by headingFontFamily.
If not set, it uses the form's display font.
Density Presets
Instead of setting each spacing value individually, use the density
preset to apply a consistent spacing scale. Individual tokens always override
preset values if both are set.
<script>
FileGrabWidget.form({
formId: 'YOUR_FORM_ID',
container: '#filegrab-form',
theme: {
density: 'spacious',
},
});
</script> | Preset | Input Padding | Field Gap | Label Size | Input Size | Button Padding |
|---|---|---|---|---|---|
compact | 6px 10px | 12px | 12px | 13px | 8px 16px |
normal | (default) | (default) | (default) | (default) | (default) |
spacious | 14px 16px | 28px | 14px | 16px | 20px 48px |
You can combine a preset with individual overrides. For example, start with
density: 'spacious' and override just the button radius:
theme: {
density: 'spacious',
buttonBorderRadius: '9999px',
} Captcha Theme
Every form includes Cloudflare Turnstile bot protection. By default the
captcha widget uses a light appearance. On dark backgrounds, switch to
'dark' or 'auto' to follow the visitor's system
preference.
<script>
FileGrabWidget.form({
formId: 'YOUR_FORM_ID',
container: '#filegrab-form',
captchaTheme: 'dark',
});
</script> | Value | Description |
|---|---|
'light' | Light captcha widget (default). |
'dark' | Dark captcha widget for dark-themed sites. |
'auto' | Follows the visitor's system color scheme preference. |
Callbacks
React to form lifecycle events with callback functions.
<script>
FileGrabWidget.form({
formId: 'YOUR_FORM_ID',
container: '#filegrab-form',
onReady: function() {
console.log('Form loaded');
},
onSubmit: function() {
console.log('Form submitted successfully');
},
onError: function(error) {
console.error('Submission failed:', error);
},
});
</script> | Callback | Arguments | Description |
|---|---|---|
onReady | (none) | Called when the form has loaded and is ready for interaction. |
onSubmit | (none) | Called after a successful submission. |
onError | error: string | Called when submission fails. The error message is passed as an argument. |
Full Example
Here is a complete example that matches a form to a host site using a serif heading font, sans-serif body, teal accent, spacious layout, and a pill-shaped submit button.
<div id="filegrab-form"></div>
<script src="https://filegrab.link/widget/filegrab-widget.umd.js"></script>
<script>
FileGrabWidget.form({
formId: 'YOUR_FORM_ID',
container: '#filegrab-form',
captchaTheme: 'light',
theme: {
// Colors
primaryColor: '#0d9488',
backgroundColor: 'transparent',
textColor: '#1a2e35',
// Fonts (loaded inside the iframe)
fontCssUrl: 'https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600&family=Nunito+Sans:wght@400;500;600&display=swap',
fontFamily: "'Nunito Sans', sans-serif",
headingFontFamily: "'Cormorant Garamond', Georgia, serif",
// Spacing
borderRadius: '8px',
inputPadding: '16px 24px',
fieldGap: '32px',
labelFontWeight: '600',
labelFontSize: '15px',
inputFontSize: '16px',
// Submit button
buttonPadding: '24px 64px',
buttonFontSize: '16px',
buttonFontWeight: '600',
buttonBorderRadius: '9999px',
// Title
titleFontSize: 'clamp(1.75rem, 3vw, 2.25rem)',
},
onReady: function() {
console.log('Form ready');
},
onSubmit: function() {
console.log('Submitted');
},
});
</script> All Options Reference
Complete list of every option accepted by FileGrabWidget.form().
| Option | Type | Required | Description |
|---|---|---|---|
formId | string | Yes | Your form's unique ID (from the form settings panel). |
container | string | HTMLElement | Yes | CSS selector or DOM element where the form renders. |
theme | object | No | Theme override object (see sections above). |
captchaTheme | 'light' | 'dark' | 'auto' | No | Captcha widget appearance. Default: 'light'. |
onReady | function | No | Called when form is loaded and interactive. |
onSubmit | function | No | Called after successful submission. |
onError | function(error: string) | No | Called when submission fails. |
Theme Properties
| Property | Type | Category | Description |
|---|---|---|---|
primaryColor | string | Color | Accent color (buttons, focus rings). |
backgroundColor | string | Color | Form card background or 'transparent'. |
textColor | string | Color | Primary text color. |
fontFamily | string | Font | Body font-family. |
headingFontFamily | string | Font | Heading font-family. |
fontCssUrl | string | Font | URL to font stylesheet (loaded in iframe). |
borderRadius | string | Spacing | Card and input border radius. |
inputPadding | string | Spacing | Input/select/textarea padding. |
fieldGap | string | Spacing | Gap between form fields. |
labelFontWeight | string | Spacing | Label font weight. |
labelFontSize | string | Spacing | Label font size. |
inputFontSize | string | Spacing | Input control font size. |
buttonPadding | string | Button | Submit button padding. |
buttonFontSize | string | Button | Submit button font size. |
buttonFontWeight | string | Button | Submit button font weight. |
buttonBorderRadius | string | Button | Submit button border radius. |
titleFontSize | string | Title | Form title font size. |
density | 'compact' | 'normal' | 'spacious' | Preset | Spacing preset (individual tokens override). |
ES Module Import
If your site uses a bundler (Vite, webpack, etc.), you can import the ESM build instead:
<script type="module">
import { form } from 'https://filegrab.link/widget/filegrab-widget.esm.js';
form({
formId: 'YOUR_FORM_ID',
container: '#filegrab-form',
theme: { primaryColor: '#0d9488' },
});
</script> Need Help?
Build your form at /form/new, customize it visually
in the form builder, then copy the embed code from the settings panel.
Add a theme object to match your site's design.
Questions? Get in touch.