An open source design system that's fully customizable and agent ready
TypeScript
fix(Field): forward rest props and style escape hatches in FieldLabel (#4097)
Cindy Zhangd31f5a877b47
diff --git a/.changeset/field-label-forward-rest.md b/.changeset/field-label-forward-rest.mdnew file mode 100644index 0000000000..8a02552694--- /dev/null+++ b/.changeset/field-label-forward-rest.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] FieldLabel now forwards className, style, xstyle, and pass-through attributes (data-_, aria-_, event handlers) to the rendered element. Previously these were accepted by the type but silently dropped.++@cixzhangdiff --git a/packages/core/src/Field/FieldLabel.tsx b/packages/core/src/Field/FieldLabel.tsxindex 0c1e7e5212..98603bc5d5 100644--- a/packages/core/src/Field/FieldLabel.tsx+++ b/packages/core/src/Field/FieldLabel.tsx@@ -171,7 +171,11 @@ export function FieldLabel({labelTooltip,description,descriptionID,+ className,+ style,+ xstyle,ref,+ ...rest}: FieldLabelProps) {const statusText = isOptional ? 'Optional' : isRequired ? 'Required' : null;@@ -207,13 +211,17 @@ export function FieldLabel({// `htmlFor` only applies to a real `<label>` associating with a single// control; a group label (span) has no `htmlFor`.htmlFor={isGroupLabel ? undefined : inputID}+ {...rest}{...mergeProps(themeProps('field-label'),stylex.props(styles.label,isDisabled && styles.labelDisabled,isLabelHidden && styles.srOnly,+ xstyle,),+ className,+ style,)}>{labelContent}</LabelElement>