Last modified: August 22, 2025
The UI extensions SDK is the foundation for adding app card functionality, providing an assortment of methods and utilities that enable you to:
- Access account, extension, and user context
- Perform actions like displaying alert banners
- Log custom messages for debugging
- Render the UI through UI components
Registering the extension
UI extensions, like any React front-end, are written as React components. However, unlike typical React components, you must register your UI extension with HubSpot by includinghubspot.extend()
inside the component file instead of exporting it. This is not required when you create a sub-component. For cleaner code, reuse and include them inside your extension.
The hubspot.extend()
function receives the following arguments:
context
: provides account, extension, and user context to the extension.actions
: makes actions available to the extension.
hubspot.extend()
or the extension component.
Access context data
Thecontext
object, passed to the extension component via hubspot.extend()
, contains data related to the authenticated user and HubSpot account, along with data about where the extension was loaded. It has the following fields:
Field | Type | Description |
---|---|---|
crm.objectId | Number | The ID of the CRM record (e.g., contact ID). |
crm.objectTypeId | String | The ID of the CRM record’s object type (e.g., 0-1 ). See the full list of object IDs for reference. |
extension.appId | Number | The extension’s app ID. |
extension.appName | String | The name of the extension’s app. |
extension.cardTitle | String | The extension’s title. |
location | 'crm.record.tab' | 'crm.record.sidebar' | crm.preview | helpdesk.sidebar | The UI extension’s location. |
portal.id | Number | The ID of the HubSpot account. |
portal.timezone | String | The account’s timezone. |
portal.dataHostingLocation | 'na1' | 'na2' | 'na3' | 'ap1' | 'eu1' | Geographic identifier that denotes the region where the current portal is hosted. See HubSpot Cloud Infrastructure FAQ for more details. |
teams | Array | An array containing information about teams that the user is assigned to. Each team object contains the id and name of the team, along with a teammates array that lists the IDs of other users on the team. |
user.email | String | The user’s email address. |
user.emails | String[] | All of the user’s associated email addresses. |
user.firstName | String | The user’s first name. |
user.id | Number | The user’s ID. |
user.locale | String | The user’s locale. |
variables | Object | All of the project’s config profile variables. |
Actions
Below are the actions that the SDK enables you to perform. Note that some UI components include a set of actions separate from the SDK actions below, such as the CRM action components.- Display alert banners
- Fetch CRM property data
- Refresh CRM record properties
- Listen for property updates
- Open overlays
- Open an iframe in a modal
- Copy text to clipboard
- Upload files
Display alert banners
Use theaddAlert
method to send alert banners as a feedback for any actions to indicate success or failure. addAlert
is a part of the actions
object that can be passed to extension via hubspot.extend
. If you instead want to render an alert within a card, check out the Alert component.
.png)
addAlert
action is passed into hubspot.extend()
and the Extension
component, then is triggered when the hubspot.fetch()
function successfully executes.
Prop | Type | Description |
---|---|---|
title | String | The bolded text of the alert. |
message | String | The main alert text. |
variant | 'info' (default) | 'tip' | 'success' | 'warning' | 'danger' | The color of the alert.
|
Fetch CRM property data
There are multiple ways to fetch CRM property data via the SDK:- The
useCrmProperties
hook, which fetches properties from the current CRM record. While similar tofetchCrmObjectProperties
, it offers automatic state management, supports property formatting, and automatically updates as properties are changed without needing to refresh. - The
fetchCrmObjectProperties
action, which fetches property data client-side at extension load time. This method is described below. propertiesToSend
, which can be included in yourhubspot.fetch()
functions to fetch property data on the back-end at function invocation time.- Use GraphQL to query CRM data through the
/collector/graphql
endpoint. Learn more about querying CRM data using GraphQL.
To make GraphQL requests, your app must include the following scopes:
collector.graphql_schema.read
collector.graphql_query.execute
While this method is still supported, you may want to switch to using the
useCrmProperties
hook instead, which fetches properties from the current CRM record. While similar to fetchCrmObjectProperties
, it offers automatic state management, supports property formatting, and automatically updates as properties are changed without needing to refresh.fetchCrmObjectProperties
method, you can get property values from the currently displaying CRM record without having to use HubSpot’s APIs. This method is a part of the actions
object that can be passed to the extension via hubspot.extend
. You’ll first need to add the object to objectTypes
inside the card’s .json
config file. The objects you specify in objectTypes
will also set which CRM objects will display the extension.
fetchCrmObjectProperties
is formatted as:
Refresh properties on the CRM record
UserefreshObjectProperties
to refresh the property data on the CRM record, and any CRM data components on the record without needing to refresh the page. This includes cards added to the record through HubSpot’s UI. This method will work for the CRM objects that you include in the extension’s .json
file in the objectTypes
array.
Listen for property updates
UseonCrmPropertiesUpdate
to subscribe to changes made to properties on the CRM record and run hubspot.fetch()
functions based on those changes. This only includes changes made from within the HubSpot UI, not property updates from outside the UI, such as via APIs. This action is intended to be used like a React hook.
The full API for this method is as follows:
error
argument to the callback.
Open overlays
To add another layer of UI to your extension, you can include overlays using the Modal and Panel components.Modal
: a pop-up dialog box best suited for short messages and action confirmations. A'danger'
variant is included for destructive actions, such as deleting a contact.Panel
: a slide-out sidebar best suited for longer, compartmentalized tasks that users might need to perform, such as multi-step forms. Includes a'modal'
variant to obscure page content outside of the panel to focus the user on the panel task.
- Add the
overlay
prop to a Button, LoadingButton, Link, Tag, or Image component. - Add the
Modal
orPanel
component into theoverlay
prop.

Button
, LoadingButton
, Link
, Tag
, or Image
component within overlay
that triggers the closeOverlay
action in an onClick
event. To use this action, you’ll need to include the actions
argument in hubspot.extend()
.
Below are examples of a panel overlay and a modal overlay.
- Panel
- Modal

Open an iframe in a modal
Similar toaddAlert
and fetchCrmObjectProperties
, you can pass openIframeModal
to the extension through the actions
object. This action includes a callback, which you can use to run a function when the iframe modal is closed. The callback doesn’t receive any parameters.
openIframeModal
takes the following payload:
Copy text to clipboard
Use thecopyTextToClipboard
action to copy text to your clipboard. This action can be accessed through the actions argument (actions.copyTextToClipboard
) and returns a promise that resolves once the system clipboard has been updated. Its functionality is provided by the Clipboard: writeText() method and follows the same requirements.
This action only works after the user has interacted with the page after loading (transient activation).
Upload files
While there is no UI component for uploading files, there are a few ways you can upload files:- Create a custom file type property, then use a CRM property list component to display and manage the property from CRM records. You can upload up to 10 files per file property, and file uploaded via file properties have the same size and type limitations as files uploaded to the file manager.
- Include an iframe modal in the extension that loads an upload page, then upload files through the iframe.
Hooks
The SDK provides hooks to simplify fetching CRM data within UI extensions located in the CRM. These hooks are optimized to prevent unnecessary re-renders, and automatically clean up resources when components unmount. You can pass inline arrays and objects to the hooks directly, as memoization is not required. The following hooks are available, and are documented in more detail below: To use these hooks, import them from@hubspot/ui-extensions/crm
.
These hooks cannot be used for UI extensions in app home and settings pages.
useCrmProperties
TheuseCrmProperties
hook allows fetches properties from the current CRM record with optional formatting. It accepts an array of properties to fetch, along with an optional object to format the returned data.
- Call
- Response
Either
'all'
or an array of property names to format.Contains formatting options for the values returned from date, datetime, and currency properties.
- The
date
anddateTime
objects can includeformat
andrelative
subfields:format
(string): a date or datetime string likeMM-DD-YYYY
orMM-DD-YYYY:mm:ss
. Supports standard date time string formats.relative
(boolean): set totrue
to display the amount of time passed since the returned value (e.g.,(1 day ago)
or(1 hour ago)
).
- The
currency
object can includeaddSymbol
(boolean), which sets whether the currency symbol should display with the number. Set totrue
to display the currency symbol.
Formatting is applied based on property type (
date
, datetime
, currency
) rather than content. For example, date
formatting will not apply to a string type property containing a date value.Example usage
useAssociations
TheuseAssociations
hook fetches CRM records of a specific object type associated with the currently displaying record. It accepts an object containing configuration details for the association fetch request, and an optional object that formats returned property data.
- Call
- Response
Configures the association data fetch request with:
toObjectType
: the object type ID to fetch associations from (e.g., ‘0-1’ for contacts).properties
: an optional array of properties to fetch from associated records.pageLength
: an optional number of items per page (defaults to 10).
Either
'all'
or an array of property names to format.Contains formatting options for the values returned from date, datetime, and currency properties.
- The
date
anddateTime
objects can includeformat
andrelative
subfields:format
(string): a date or datetime string likeMM-DD-YYYY
orMM-DD-YYYY:mm:ss
. Supports standard date time string formats.relative
(boolean): set totrue
to display the amount of time passed since the returned value (e.g.,(1 day ago)
or(1 hour ago)
).
- The
currency
object can includeaddSymbol
(boolean), which sets whether the currency symbol should display with the number. Set totrue
to display the currency symbol.
Example usage
Send custom log messages for debugging
Usinglogger
methods, you can send custom log messages to HubSpot for more in-depth troubleshooting of deployed extensions. Custom log messages will appear in the app’s logs in HubSpot.
The following methods are available:
logger.info
logger.debug
logger.warn
logger.error

Notes and limitations
- Custom log messages are not sent while in local development mode. They are logged to the browser console instead.
- All logs are sent as batches with a maximum of 100 logs per batch.
- Each HubSpot account is rate limited to 1,000 logs per minute. After exceeding that limit, all logging is stopped until the page is reloaded.
- The logger will queue a maximum of 10,000 pending messages. Any subsequent logs will be dropped until the queue is below the maximum.
- Queued logs are processed at a rate of five seconds per log batch.
- Queued logs are dropped when the page or is refreshed or closed.