From be72ce433520bf01b0d2b7864ad25ec78da90b67 Mon Sep 17 00:00:00 2001 From: Mike Perrotti Date: Fri, 12 Sep 2025 13:26:36 -0400 Subject: [PATCH 1/4] adds sx prop back to TextInput --- .../src/TextInput/TextInput.dev.stories.tsx | 18 ++++++++++++++++++ packages/react/src/TextInput/TextInput.tsx | 7 ++++++- .../internal/components/TextInputWrapper.tsx | 3 ++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/packages/react/src/TextInput/TextInput.dev.stories.tsx b/packages/react/src/TextInput/TextInput.dev.stories.tsx index ebcf5fc62cd..356f21970c3 100644 --- a/packages/react/src/TextInput/TextInput.dev.stories.tsx +++ b/packages/react/src/TextInput/TextInput.dev.stories.tsx @@ -18,3 +18,21 @@ export const WithCSS = () => ( ) + +export const WithSx = () => ( +
+ + Default label + + +
+) + +export const WithSxAndCSS = () => ( +
+ + Default label + + +
+) diff --git a/packages/react/src/TextInput/TextInput.tsx b/packages/react/src/TextInput/TextInput.tsx index 2aa6c615451..e787ab4f785 100644 --- a/packages/react/src/TextInput/TextInput.tsx +++ b/packages/react/src/TextInput/TextInput.tsx @@ -40,7 +40,10 @@ export type TextInputNonPassthroughProps = { */ trailingAction?: React.ReactElement> } & Partial< - Pick + Pick< + StyledWrapperProps, + 'block' | 'contrast' | 'disabled' | 'monospace' | 'variant' | 'size' | 'sx' | 'validationStatus' + > > export type TextInputProps = Merge, TextInputNonPassthroughProps> @@ -67,6 +70,7 @@ const TextInput = React.forwardRef( onBlur, // start deprecated props variant: variantProp, + sx: sxProp, // end deprecated props type = 'text', required, @@ -128,6 +132,7 @@ const TextInput = React.forwardRef( isInputFocused={isInputFocused} onClick={focusInput} aria-busy={Boolean(loading)} + sx={sxProp} > {IconComponent && } Date: Fri, 12 Sep 2025 13:28:07 -0400 Subject: [PATCH 2/4] adds changeset --- .changeset/silly-parks-give.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/silly-parks-give.md diff --git a/.changeset/silly-parks-give.md b/.changeset/silly-parks-give.md new file mode 100644 index 00000000000..aaf865164d0 --- /dev/null +++ b/.changeset/silly-parks-give.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Adds `sx` prop back to TextInput From d0afc0845d059d42b20a68bbabf39fce25e27be0 Mon Sep 17 00:00:00 2001 From: Mike Perrotti Date: Fri, 12 Sep 2025 14:03:05 -0400 Subject: [PATCH 3/4] adds 'sx' prop back to Textarea --- packages/react/src/Textarea/Textarea.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react/src/Textarea/Textarea.tsx b/packages/react/src/Textarea/Textarea.tsx index c7eb10d693c..174b49125c7 100644 --- a/packages/react/src/Textarea/Textarea.tsx +++ b/packages/react/src/Textarea/Textarea.tsx @@ -3,6 +3,7 @@ import React from 'react' import {TextInputBaseWrapper} from '../internal/components/TextInputWrapper' import type {FormValidationStatus} from '../utils/types/FormValidationStatus' import classes from './TextArea.module.css' +import type {SxProp} from '../sx' export const DEFAULT_TEXTAREA_ROWS = 7 export const DEFAULT_TEXTAREA_COLS = 30 @@ -45,7 +46,8 @@ export type TextareaProps = { * CSS styles to apply to the Textarea */ style?: React.CSSProperties -} & TextareaHTMLAttributes +} & TextareaHTMLAttributes & + SxProp /** * An accessible, native textarea component that supports validation states. @@ -67,6 +69,7 @@ const Textarea = React.forwardRef( minHeight, maxHeight, style, + sx: sxProp, ...rest }: TextareaProps, ref, @@ -78,6 +81,7 @@ const Textarea = React.forwardRef( block={block} contrast={contrast} className={className} + sx={sxProp} >