Prerequisites
- Your
applicationIdfrom the Entri dashboard - A valid JWT token fetched from your server
- Basic understanding of React hooks
Installation
- NPM Package
- Script Tag
Using the Hook
Once you have the hook, use it in your components:Event Handling
Entri emits events viawindow. Set up listeners in useEffect before calling showEntri().
Events work the same way for both NPM and Script Tag installations.
onSuccess
Triggered when the user successfully completes domain setup.onEntriClose
Triggered when the modal is closed, whether successful or not.onEntriStepChange
Triggered when the user moves between screens. Useful for analytics.onEntriManualSetupDocumentationClick
Triggered when the user clicks the manual setup guide link.Troubleshooting
Event listeners not firing
Make sure you’re adding listeners before callingshowEntri(). In React, use useEffect to set up listeners on mount:
Stale state in event handlers
React’s closures can capture stale state. Use refs or functional updates:Multiple event handlers firing
Ensure you clean up listeners when the component unmounts:Focus Trap Conflicts
When using Entri with React UI libraries that implement their own focus management (Reach UI Dialog, Radix UI), you may experience focus conflicts where tab navigation breaks.The Problem
Both Entri and your modal library compete for focus control. Common symptoms:- Tab key not cycling through elements correctly
- Focus jumping unexpectedly
- Screen reader navigation issues
Solution 1: Embedded Mode (Recommended)
Mount Entri inside your existing dialog using embedded mode:Solution 2: Disable Focus Lock When Entri is Active
Use a state flag to disable your focus trap while Entri is open:This issue has been observed with Reach UI Dialog specifically, but may occur with other libraries that implement aggressive focus locking.
Next Steps
- Configuration Reference - Full configuration options
- Webhooks - Server-side event handling
- Getting Started - Dashboard setup and token generation

