Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(core): increase trailing padding on ChatLayoutScrollButton label (#3128)

Cindy Zhange2d38fb7ba76
diff --git a/.changeset/chatlayoutscrollbutton-label-padding.md b/.changeset/chatlayoutscrollbutton-label-padding.md
new file mode 100644
index 0000000000..d2b9ce9b46
--- /dev/null
+++ b/.changeset/chatlayoutscrollbutton-label-padding.md
@@ -0,0 +1,13 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] Increase trailing padding on `ChatLayoutScrollButton` when a label is shown
+@cixzhang
+
+With a label (e.g. "New messages"), the chevron icon sits on the leading edge
+and the text on the trailing edge. The symmetric inline padding left the label
+text cramped against the pill's rounded corner. The trailing inline padding is
+now widened when a label is present, giving the text comfortable breathing room
+from the rounded edge. The icon-only (collapsed) state is unchanged and stays
+balanced.
diff --git a/packages/core/src/Chat/ChatLayoutScrollButton.tsx b/packages/core/src/Chat/ChatLayoutScrollButton.tsx
index 01d37f9b6e..e1d1e430d8 100644
--- a/packages/core/src/Chat/ChatLayoutScrollButton.tsx
+++ b/packages/core/src/Chat/ChatLayoutScrollButton.tsx
@@ -90,6 +90,12 @@ const styles = stylex.create({
whiteSpace: 'nowrap',
paddingInline: spacingVars['--spacing-2'],
},
+ // When a label is shown, the icon sits on the leading edge and the text on
+ // the trailing edge. Symmetric padding leaves the text cramped against the
+ // pill's rounded edge, so give the trailing side extra breathing room.
+ buttonWithLabel: {
+ paddingInlineEnd: spacingVars['--spacing-3'],
+ },
});
// =============================================================================
@@ -130,7 +136,7 @@ export function ChatLayoutScrollButton({
variant="ghost"
size="md"
onClick={onClick}
- xstyle={styles.button}>
+ xstyle={[styles.button, label ? styles.buttonWithLabel : null]}>
{label ?? undefined}
</Button>
</div>