If you want to override the Assistant overall style or any specific area, this guide will help you.
The Assistant uses a feature called Shadow DOM. This keeps its styles separate from your website, preventing conflicts. However, it also means:
Your website's main CSS won't affect the Assistant.
You need to use JavaScript to add custom styles inside its Shadow DOM.
Crucially, you can only do this after the Assistant is fully loaded and ready on the page. Trying too early won't work.
The Solution: The tdAssistantConnected Event
To solve the timing issue, the ThriveDesk Assistant emits a custom event called tdAssistantConnected as soon as it's fully initialized and added to your page.
By "listening" for this event, you can safely access the Assistant's Shadow DOM and add your styles.
How to Do It:
Place this script tag on your page:
Copy
<script>
document.addEventListener('tdAssistantConnected', (event) => {
// event.target is the <thrivedesk-assistant> element
const assistantElement = event.target;
const shadowRoot = assistantElement.shadowRoot;
if (shadowRoot) {
// 1. Create a <style> element
const customStyles = document.createElement('style');
// 2. Add your CSS rules
// Example: Move the launcher button
customStyles.textContent = `
/* Position the launcher button */
.td-launcher {
right: 100px !important;
bottom: 50px !important;
}
/* Adjust the assistant window position */
.td-assistant {
right: 100px !important;
bottom: 130px !important;
}
`;
// 3. Append your styles to the Assistant's Shadow DOM
shadowRoot.appendChild(customStyles);
console.log('Custom styles applied to ThriveDesk Assistant.');
} else {
console.error('ThriveDesk Assistant shadowRoot not found.');
}
});
</script>Why This Method?
Reliability: Your styling code only runs when the Assistant is definitely ready.
Correct Scope: Styles are correctly applied within the Assistant's encapsulated Shadow DOM.
This approach ensures your custom styles are applied effectively without interfering with the rest of your page or the Assistant's internal operations.
Commonly Used CSS Classes
The following table lists some of the most commonly used CSS classes:
CSS Class | Description |
| Main Assistant Window |
| Header section of the assistant |
| Main content area |
| Footer section with navigation |
| The widget cards on the home page |
| Main container for the launcher |
| Icon within the launcher button |
| Text shown in the launcher |
| Main Livechat container |
| Main Contact Form container |
| Main Order Status container |
| Main Knowledge Base container |
Why Not Just querySelector and Style?
While you could try something like this:
// Potentially unreliable approach
const assistant = document.querySelector('thrivedesk-assistant');
if (assistant && assistant.shadowRoot) {
const styleTag = document.createElement('style');
styleTag.textContent = '.td-launcher-button-container { right: 100px !important; }';
assistant.shadowRoot.appendChild(styleTag);
}This approach has a higher risk of failure due to timing:
Script Execution Order: If this script runs before the
<thrivedesk-assistant>element is defined and upgraded by the browser,document.querySelector('thrivedesk-assistant')might returnnullor an uninitialized element.shadowRootAvailability: Even if the element is found, itsshadowRootmight not be attached immediately. TheconnectedCallback(where thetdAssistantConnectedevent is fired) is the guaranteed point at which the element is part of the DOM and set up.
Using the tdAssistantConnected event ensures that your styling logic runs only after the component is fully ready, making your customizations more robust and reliable.
Important Notes
Use
!importantin your CSS rules to ensure they override the default stylesTest your customizations across different browsers and devices
Your styles will be applied each time the Assistant loads on your page
CSS variables (custom properties) defined on the
:hostcan also be overridden for consistent theming