Add Custom Styles
Need to tweak the look of the ThriveDesk Assistant launcher? Here’s how to do it reliably.
Component CSS Class Reference
<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>Commonly Used CSS Classes
CSS Class
Description
Why Not Just querySelector and Style?
querySelector and Style?Important Notes
Last updated