Collect the buyer's email address with a secure, fully styleable input.
The Email component (fs-email) renders an email input inside a secure iframe served from FastSpring's domain. The value maps to customer.billToContact.email in the session. The component renders no section header, so add your own heading above it on the page.
This page is the complete reference for the Email component: how to mount it, the options it accepts, the states it exposes for styling, and every style category and property available. For setup context, see the Integration Guide.
Mount
Add a target element to your HTML:
<div id="email-element"></div>Then create the component from your sdk instance and mount it:
const emailComponent = sdk.components.create('fs-email', {
// options + style go here
});
emailComponent.mount('#email-element');Component options
Top-level options passed alongside style:
| Option | Type | Default | Description |
|---|---|---|---|
labelMode | 'floating' | 'fixed' | 'floating' | Label placement. 'floating': the label starts inside the input as a placeholder and moves above the field on focus or when filled. 'fixed': the label sits above the input. |
How styling works
Styling is configured through a style object passed at component creation. Each state contains one or more style categories (email, label, input, inlineError) that group related properties.
sdk.components.create('fs-email', {
style: {
state: {
default: { /* base styles */ },
hover: { /* applied on hover */ },
focus: { /* applied on focus */ },
error: { /* applied in error state */ },
},
},
});Style precedence: FastSpring uses the first value it finds, in this order:
- The style you set for the current state (e.g.,
state.focus.input) - The style you set for the
defaultstate (e.g.,state.default.input) globalStylespassed toFastSpring.init()- FastSpring's built-in default (the Default column in the tables below)
Available states
| State | When applied |
|---|---|
default | Always (the base styling) |
hover | The pointer is over the input. No visual change, and overrides under hover are not applied. |
focus | The input has keyboard focus |
error | The buyer leaves the field with an invalid address, or clicks Pay while a required field is empty |
For what each state changes out of the box, see Default values per state.
Style categories
Each category below targets a specific part of the Email component. Select a card to jump to its full property reference.
The default font family for every category is Helvetica Neue, helvetica, arial, sans-serif, written as Helvetica Neue stack in the tables below.
email: component width
email: component widthThere is no panel around the field: background, border, and shadow come from your page. Text color and font are set per part (label, input, inlineError) or once for every component with globalStyles.
| Property | Type | Default | Description |
|---|---|---|---|
maxWidth | string | 680px | Caps the width on wide screens. 'none' removes the cap. |
input: the email field
input: the email field| Property | Type | Default | Description |
|---|---|---|---|
backgroundColor | string | #ffffff | Input background |
borderColor | string | #DEE2E6 | Border color |
errorBorderColor | string | #EB1431 | Border color in the error state |
borderRadius | string | 4px | Corner radius |
color | string | #4B5563 | Text color |
fontFamily | string | Helvetica Neue stack | Font family |
fontSize | string | 16px | Font size |
fontWeight | string | number | 400 | Font weight |
height | string | 48px | Input height |
padding | string | 0 16px | Inner padding. In floating label mode, the top and bottom padding are 16px and 4px to make room for the label. |
margin | string | 0 | Outer margin |
outline | string | none | Focus-ring shorthand (e.g., '1px solid #bfdbfe') |
outlineColor | string | rgba(0, 138, 255, .2) | Color of the focus glow |
placeholderColor | string | #7D8A9B | Flat alternative to setting '::placeholder'.color |
'::placeholder' | object | (see description) | Nested placeholder styles. Supports color, fontSize, fontFamily, fontWeight. Inner defaults: color: #7D8A9B, fontSize: 16px, fontWeight: 400, Helvetica Neue stack. |
label: the field label
label: the field label| Property | Type | Default | Description |
|---|---|---|---|
color | string | #4B5563 | Label text color |
fontSize | string | 14px | Label font size |
fontWeight | string | number | 400 | Label font weight |
fontFamily | string | Helvetica Neue stack | Label font family |
backgroundColor | string | transparent | Label background |
In floating mode, the label sits inside the empty input using the placeholder styling (#7D8A9B, 16px). When the field is focused or filled, it moves to the top at .8rem. Under the error state, label.color tints the floating label; by default it follows input.errorBorderColor (#EB1431). In fixed mode, the label stays above the input in label.color, and the empty input shows the placeholder "Enter email address".
inlineError: inline validation error messages
inlineError: inline validation error messages| Property | Type | Default | Description |
|---|---|---|---|
color | string | #EB1431 | Error message text color |
fontSize | string | 12px | Error message font size |
fontWeight | string | number | 400 | Error message font weight |
fontFamily | string | Helvetica Neue stack | Error message font family (follows the component font) |
backgroundColor | string | transparent | Error message background |
The error slot reserves 16px of height so the layout doesn't shift when an error appears.
| Situation | When it's shown | Message |
|---|---|---|
| Invalid email format | When the buyer leaves the field | "Enter a valid email address." |
| Empty field (required) | When the buyer clicks Pay | "Enter your email address." |
Default values per state
Out of the box, the Email component visually changes for focus and error. Only the combinations below can be overridden; others are ignored.
| State | What you can override |
|---|---|
focus | input: borderColor, backgroundColor, outline |
error | input: borderColor, backgroundColor, color · label: color (tints the floating label; follows input.errorBorderColor by default) · inlineError: all properties |
hover | None. Overrides under hover are not applied. |
inlineError styling is also accepted under default; the error value wins when both are set.
focus
focusApplied when the input has keyboard focus.
| Property | Default override value |
|---|---|
input.borderColor | #2563EB |
| Focus glow | 0 0 0 4px rgba(0, 138, 255, .2) (soft blue glow) |
| Floating label color | #2563EB |
error
errorApplied when validation fails.
| Property | Default override value |
|---|---|
input.errorBorderColor | #EB1431 |
input.color | #EB1431 |
| Focus glow | 0 0 0 4px color-mix(in srgb, #EB1431 25%, transparent) |
label.color (floating label) | #EB1431 |
Read-only mode
Applied when fields.email is 'readonly'. This is a mode, not a style state.
| Property | Default override value |
|---|---|
input.backgroundColor | #E7E7E7 |
| Focus border and glow | Turned off |
| Floating label on focus | Still turns #2563EB |
Full example
sdk.components.create('fs-email', {
labelMode: 'floating',
style: {
state: {
default: {
email: {
maxWidth: '520px',
},
label: {
color: '#374151',
fontSize: '14px',
fontFamily: 'Inter, sans-serif',
},
input: {
fontFamily: 'Inter, sans-serif',
backgroundColor: '#f9fafb',
borderColor: '#e5e7eb',
height: '48px',
placeholderColor: '#9ca3af',
},
inlineError: {
color: '#dc2626',
fontSize: '13px',
},
},
focus: {
input: {
borderColor: '#2563eb',
},
},
error: {
input: {
borderColor: '#dc2626',
},
},
},
},
}).mount('#email-element');