Skip to content

Embedding Screens

Every option renders the Screen in an iframe hosted by Friendly Payroll. Your page never handles payroll data directly. Pick whichever fits your stack:

Option Use it when
<friendly-payroll> Any framework (Vue, Svelte, Angular, Solid, server-rendered HTML…).
<FriendlyPayroll> React 18 or 19.
Plain iframe URL No JavaScript is available, as in some no-code tools and mobile WebViews.
<script src="https://embed.friendlypayroll.com/v1/embed.js" async></script>

The script registers <friendly-payroll>. It also exposes window.FriendlyPayroll.

<friendly-payroll
client-secret="fpcs_sandbox_…"
screen="employer-dashboard"
></friendly-payroll>
Attribute Property Description
client-secret clientSecret From your server’s Session. Required.
screen screen Which Screen to show. It must be one of the Session’s Screens. Required.
options options Screen options as JSON (attribute) or an object (property). See Screen options.
color-mode colorMode light, dark or system. Overrides the Session’s Theme.

Changing any of these reloads the Screen. The element also has a read-only status property. See events.

<friendly-payroll> is a block element 640px tall by default, and the Screen scrolls inside it. Set its height with CSS to fit your layout:

friendly-payroll {
height: calc(100vh - 64px); /* e.g. fill the page below your header */
}

When a Screen opens a dialog, the element temporarily covers the whole viewport. It returns to its normal size when the dialog closes. Listen for modalchange if you need to react, for example by hiding a chat widget.

Terminal window
npm install @friendlypayroll/react
import { FriendlyPayroll } from '@friendlypayroll/react';
<FriendlyPayroll
clientSecret={clientSecret}
screen="employer-onboarding"
options={{ includeSteps: ['tax-info', 'pay-schedule'] }} // typed for the chosen Screen
colorMode={isDark ? 'dark' : 'light'}
style={{ height: '80vh' }}
onStatusChange={status => console.log(status)}
onScreenEvent={({ name }) => name === 'complete' && navigate('/payroll')}
/>;

<FriendlyPayroll> is a thin wrapper around <friendly-payroll>, so everything on this page applies. It’s a client component ('use client').

If you can’t run JavaScript, point an iframe at the embed URL directly. Put the client secret in the URL fragment (after #), which browsers never send to servers:

<iframe
src="https://embed.friendlypayroll.com/?screen=worker-payment-list#fpcs_prod_…"
style="width: 100%; height: 640px; border: 0"
></iframe>
Query parameter Description
screen Required. The Screen to show.
options Screen options as URL-encoded JSON.
colorMode light, dark or system.
parentOrigin Your page’s origin. Set it to receive events through postMessage.

Plain iframes don’t go full-screen for dialogs, so give them plenty of height.

To build the URL in code, @friendlypayroll/embed exports embedUrl({ clientSecret, screen, options, colorMode }).