Skip to content

Commit 7dd128b

Browse files
fix: properly coordinate borders and border-radius between input and addons
Fix the border and border-radius coordination so prefix/suffix addons connect seamlessly with the input field without visible gaps. Changes: - Move border/radius removal logic from InputGroupInput to TextField - TextField now explicitly passes 'rounded-l-none border-l-0' when prefix exists - TextField now explicitly passes 'rounded-r-none border-r-0' when suffix exists - Simplified InputGroupInput to just handle base styling - This matches the original implementation's approach exactly Result: Borders and corners now connect cleanly between addons and input, matching the original FieldPrefix/FieldSuffix behavior. Requested by: Jake Ruesink
1 parent 1d3809d commit 7dd128b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

packages/components/src/ui/input-group.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,8 @@ function InputGroupInput({ className, ...props }: React.ComponentProps<'input'>)
128128
data-slot="input-group-control"
129129
className={cn(
130130
// Match original input styling but remove focus ring/offset (handled by wrapper)
131-
// Remove left border and radius if prefix exists, remove right if suffix exists
131+
// Border removal for prefix/suffix should be handled by the parent component
132132
'flex-1 focus-visible:ring-0 focus-visible:ring-offset-0 border-input',
133-
// Conditionally remove borders based on presence of addons
134-
'group-has-[>[data-align=inline-start]]:rounded-l-none group-has-[>[data-align=inline-start]]:border-l-0',
135-
'group-has-[>[data-align=inline-end]]:rounded-r-none group-has-[>[data-align=inline-end]]:border-r-0',
136133
className,
137134
)}
138135
{...props}

packages/components/src/ui/text-field.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,16 @@ export const TextField = function TextField({
9696
<InputGroupText>{prefix}</InputGroupText>
9797
</InputGroupAddon>
9898
)}
99-
<InputGroupInput {...field} {...props} ref={ref} aria-invalid={fieldState.error ? 'true' : 'false'} />
99+
<InputGroupInput
100+
{...field}
101+
{...props}
102+
ref={ref}
103+
aria-invalid={fieldState.error ? 'true' : 'false'}
104+
className={cn(props.className, {
105+
'rounded-l-none border-l-0': prefix,
106+
'rounded-r-none border-r-0': suffix,
107+
})}
108+
/>
100109
{suffix && (
101110
<InputGroupAddon align="inline-end">
102111
<InputGroupText>{suffix}</InputGroupText>

0 commit comments

Comments
 (0)