Skip to content

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

TypeScript

fix(field): vertically center required/optional indicator in FieldLabel (#3364)

athz5f1f22e59857
diff --git a/.changeset/fieldlabel-required-vertical-align.md b/.changeset/fieldlabel-required-vertical-align.md
new file mode 100644
index 0000000000..ecf95e4572
--- /dev/null
+++ b/.changeset/fieldlabel-required-vertical-align.md
@@ -0,0 +1,19 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] Vertically center the optional/required indicator in `FieldLabel`.
+
+The `label` and `optionalRequired` styles never set an explicit `lineHeight`,
+so both fell back to `line-height: normal` (~1.2), producing mismatched line
+boxes (~16.8px for the 14px label vs ~14.4px for the 12px "∙ Required" text).
+With `alignItems: center` the smaller indicator centered within its shorter box
+and rendered visually high relative to the label.
+
+Applying the intended leading tokens (`--text-label-leading` and
+`--text-supporting-leading`, both 20px) gives the two flex children equal line
+boxes so they center correctly. Affects every field that renders a
+required/optional indicator via `FieldLabel` (`Field`, `Typeahead`,
+`CheckboxInput`, `Switch`).
+
+@athz
diff --git a/packages/core/src/Field/FieldLabel.tsx b/packages/core/src/Field/FieldLabel.tsx
index 2e5f2207d0..49fd029492 100644
--- a/packages/core/src/Field/FieldLabel.tsx
+++ b/packages/core/src/Field/FieldLabel.tsx
@@ -35,6 +35,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-1'],
fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-label-size'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-medium'],
color: colorVars['--color-text-secondary'],
cursor: 'pointer',
@@ -61,6 +62,7 @@ const styles = stylex.create({
optionalRequired: {
fontWeight: fontWeightVars['--font-weight-normal'],
fontSize: typeScaleVars['--text-supporting-size'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
color: colorVars['--color-text-secondary'],
},
description: {