You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/07/17 21:37:46 UTC
(superset) 01/01: fix(components): restore icon/text spacing in Label
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch fix/label-icon-spacing
in repository https://gitbox.apache.org/repos/asf/superset.git
commit fc88638fe6fdd9e1f0aefb3cb7fe79a095b806b7
Author: Amin Ghadersohi <am...@gmail.com>
AuthorDate: Fri Jul 17 14:36:39 2026 -0700
fix(components): restore icon/text spacing in Label
The antd v6 upgrade (#41636) wrapped Label's icon in a plain span so
Tag's cloneElement style override wouldn't clobber the icon's own
styling. That wrapper broke antd Tag's icon spacing rule
(`> .anticon + span`), leaving icons flush against the label text in
every Label with an icon (e.g. the Timer and CachedLabel pills in
Explore). Re-apply the equivalent gap on the wrapper when the label
has children.
Co-Authored-By: Claude Opus 4.8 (1M context) <no...@anthropic.com>
---
.../packages/superset-ui-core/src/components/Label/index.tsx | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Label/index.tsx b/superset-frontend/packages/superset-ui-core/src/components/Label/index.tsx
index 7a1c185350b..d71cf737ade 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Label/index.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Label/index.tsx
@@ -82,6 +82,9 @@ export const Label = forwardRef<HTMLSpanElement, LabelProps>((props, ref) => {
* which would drop the icon's own color/size. Wrapping the icon in a span
* lets Tag override the (empty) wrapper style while the real icon keeps its
* own inline styling.
+ *
+ * The wrapper also breaks Tag's own icon/text spacing rule
+ * (`> .anticon + span`), so the equivalent gap is re-applied here.
*/
icon={
icon ? (
@@ -89,6 +92,7 @@ export const Label = forwardRef<HTMLSpanElement, LabelProps>((props, ref) => {
css={css`
display: inline-flex;
align-items: center;
+ ${children ? `margin-inline-end: ${theme.paddingXS}px;` : ''}
`}
>
{icon}