Set Up Vitable Drops
Every Drop uses the same three-part setup: install the SDK, expose an authenticated backend endpoint that issues bound tokens, and configure VitableConnectProvider in your React application.
Before You Begin
- A Vitable API key stored on your backend. See Authentication.
- A Vitable employee or employer ID for the signed-in user.
- React 18 or later.
1. Install the SDK
2. Create a Server-Side Token Endpoint
Your backend must authenticate the caller, confirm that they may access the requested employee or employer, and exchange its API key for a bound access token.
The authorization check in this example is intentionally application-specific. Do not issue a token based only on an ID supplied by the browser. Confirm that the signed-in user may access that employee or employer, and apply appropriate CORS, CSRF, and rate-limit controls.
3. Configure the Provider
The provider calls your backend on mount and again when the token needs to be refreshed:
Use employee for the Employee Dashboard and employer for both employer widgets.
Provider Props
Token Lifecycle
The SDK fetches a token when the provider mounts, refreshes it before expiration, retries transient fetch failures with backoff, and sends updates to the iframe. Changing contextKey discards the existing session and requests a token for the new context.
Use a stable contextKey that matches the bound entity ID. Never reuse an employee-bound token for another employee or an employer-bound token for another employer.
4. Add a Widget
Continue with the component you need:
Production Checklist
- Authenticate every token request and authorize the requested entity.
- Keep the Vitable API key in server-side secret storage.
- Allow postMessage communication only with the expected Vitable origin.
- Reset
contextKeywhenever the active employee or employer changes. - Record token-fetch and widget errors without logging tokens.
- Use
@vitable-inc/drops0.1.6 or later so members can copy their ID card details in the Employee Dashboard. If your page sends aPermissions-Policyheader or is itself embedded in a frame, allowclipboard-writefor the Vitable origin.
Theming
Every Drop supports theming through the VitableConnectProvider. Pass a theme prop to customize colors, fonts, and color mode so the embedded experience matches your application’s look and feel.
Pass the theme to the provider from step 3. Use the same object for every provider that renders Drops, including employer providers.
Theme Properties
Color Palettes
Widgets read three palettes from colors. Other keys are ignored unless primaryColor names them.
Any palette you leave out keeps Vitable’s default colors for that role. If you use colorMode: "dark" or "system", provide colors.dark so dark surfaces match your brand.
Fonts
Widgets run in an iframe and can’t use web fonts that are loaded only on your page. Name fonts that are installed on your users’ devices, or end fontFamily with a fallback such as system-ui, sans-serif. fontFamily may contain only letters, numbers, spaces, hyphens, commas, and quotes; any other value is ignored.
The theme is validated together with the session token when a widget loads. An invalid theme stops the widget from loading, not only the theming. Check that every palette has exactly 10 six-digit hex colors (#1d4ed8, not #fff or #1d4ed8ff), that primaryColor is a key in colors, that logoUrl uses HTTPS, and that sizes are a number with a leading digit followed by px, rem, em, %, pt, vh, or vw ("0.875rem", not ".875rem", "1ch", or calc(...)).
Theme updates are applied in real time — if your app supports theme switching, the embedded widgets will update automatically when you change the theme prop.

