Documentation Index
Fetch the complete documentation index at: https://gusto-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Setting Up Your Component Adapter
This guide will walk you through the process of creating and implementing your own Component Adapter for the Gusto Embedded React SDK.1. Create Your Custom Component Implementations
Each component must implement the required props interface defined by the SDK. For example, if you’re creating a custom TextInput, it must accept all the props defined in theTextInputProps interface (View interface on GitHub).
The component types extend basic HTML element props, so your implementations can accept and forward any standard HTML attributes to the underlying HTML elements. For example:
- Handles all required props correctly
- Maintains accessibility features
- Follows your design system guidelines
- Properly passes event handlers
- Forwards additional HTML attributes to the appropriate element
2. Create Your Component Adapter Object
Create an object that implements theComponentsContextType interface (View interface on GitHub) with your custom components:
3. Choose Your Provider
The SDK offers two ways to provide your custom components, each suited for different needs:Option A: Using GustoProvider (Recommended)
TheGustoProvider is the recommended approach for most applications. Using the GustoProvider, you are able to supply only the components you want to override and then the rest fall back to default React Aria components:
GustoProvider:
- Only need to implement the components you want to customize
- Includes accessible React Aria components as defaults
- Simpler integration path
- Best choice for most applications
Option B: Using GustoProviderCustomUIAdapter
If you need complete control over the UI implementation or want to optimize bundle size through tree-shaking, use theGustoProviderCustomUIAdapter:
GustoProviderCustomUIAdapter:
- Complete control over component implementation
- No React Aria dependencies included
- Better for tree-shaking and bundle size optimization
- Ideal when you want to fully customize the UI layer
- Want to implement all UI components yourself
- Need to minimize bundle size
- Don’t want React Aria as a dependency
- Have a complete design system you want to use
4. Testing Your Implementation
After implementing your Component Adapter, it’s a good practice to:- Test all components with various props and states
- Verify that event handlers work as expected
- Check accessibility features
- Test across different browsers and devices
Complete Example
Here’s an example showing how to customize a few common components using Material UI withGustoProvider. For a full list of customizable components and their props, see the Component Inventory.
How the Component Adapter Works Component Adapter Types