Connect
Our Connect
component provides a seamless user experience to authorize third-party connectors and manage connections.
The Connect
component is a versatile UI element that handles the complete connection lifecycle for third-party integrations. It provides:
- Initial connection authorization
- Connection status display
- Connection management options (re-authorization)
- Responsive state handling with loading indicators
- Customizable appearance and behavior
- Support for both popup and redirect authorization flows
Installation
Usage
Props
A sessionToken
generated from your server with the create session
method.
This token is used to identify and manage the connection.
Determines how the authorization window is opened: - popup
: Opens the
authorization URL in a new popup window (default) - redirect
: Redirects the
current window to the authorization URL When using redirect
mode, the
redirectUrl
prop is required.
The URL where the user will be redirected after authorization when using
windowMode="redirect"
. Required when windowMode
is set to redirect
.
The visual style variant of the button. Inherits from the underlying Button
component. Common values include: default
, outline
, ghost
, etc.
The size of the button. Inherits from the underlying Button component.
Available options: default
, sm
, lg
, etc.
Additional CSS classes to apply to the button for custom styling.
When true, the component will render its child as the root element instead of a button. Useful for custom implementations.
States
The Connect component handles various states automatically:
- Loading: Shows a disabled button with loading text while initializing
- Unauthorized: Displays a “Connect” button to initiate authorization
- Authorized: Shows a “Connected” button with a dropdown menu for management options
- Error: Displays an error message if something goes wrong
Internationalization
The component supports internationalization through a translation context. All text strings can be customized by providing translations for the following keys:
connect.status.loading
connect.status.error
connect.status.authorized
connect.actions.connect
connect.actions.reauthorize