I am sharing this screenshot to show the issue I’m facing. I want to wrap the above content within the card, but when I send a message or add text, the height of the card increases dynamically.
I’m currently unable to apply custom styles to this component to control its layout or height. Could you please guide me on how to style this component properly to prevent it from expanding unnecessarily?
When working with HubSpot’s @hubspot/ui-extensions, one common challenge is not being able to control the card height using regular CSS. This is because HubSpot wants all UI extensions to look and behave consistently, so it limits how much you can customize styles directly.
Why does the card keep expanding:
Built-in components (like Card, Text, Flex, etc.) come with their own styles and behavior.
Layout behavior: These components use Flexbox or similar layout rules, which means containers (like cards) automatically grow to fit their content.
No direct CSS: You usually can’t use custom CSS to control things like height or scrolling. HubSpot does this on purpose to keep designs uniform.
Style via props: Instead of CSS, you use props (like gap, align, or truncate) to tweak layout and appearance.
What you can do:
Use Flex and Box: These are your main layout tools. They let you control how content is arranged inside your card.
Fix size of inner items: You may not be able to fix the height of the card itself, but you might be able to limit the size of the items inside (like setting a maxWidth on a text element).
Avoid long content: Keep the content inside cards short and to the point.
Use truncate for text: The truncate prop cuts off long text with an ellipsis and can show the full message on hover.
If your content needs more space:
Instead of forcing everything into a small card, think about showing it in a modal window or a new tab in the CRM. HubSpot provides tools like actions.openModal() or actions.openIframeInModal() for exactly this kind of use case.
I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.