Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(ui): update input component

Steven Enamakelb62905defdff
diff --git a/app/src/components/ui/Input.tsx b/app/src/components/ui/Input.tsx
index a8fd1dddf5..2cb315b53c 100644
--- a/app/src/components/ui/Input.tsx
+++ b/app/src/components/ui/Input.tsx
@@ -1,5 +1,7 @@
import { forwardRef, type InputHTMLAttributes } from 'react';
+import { cn } from '../../lib/cn';
+
export type InputSize = 'sm' | 'md' | 'lg';
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
@@ -26,17 +28,29 @@ const Input = forwardRef<HTMLInputElement, InputProps>((props, ref) => {
const ring = invalid
? 'border-coral-400 focus:border-coral-500 focus:ring-coral-500/20 dark:border-coral-500/60'
: 'border-line-strong focus:border-primary-500 focus:ring-primary-500/20 dark:focus:border-primary-400';
- const classes = [
+ // `cn` (clsx + tailwind-merge), NOT `[...].join(' ')`.
+ //
+ // Joining left every default in the attribute next to whatever the caller
+ // passed, so which one applied was decided by Tailwind's stylesheet ordering
+ // rather than by the caller. That is not a cosmetic difference: it silently
+ // ignores the override about half the time, and which half depends on where
+ // the two utilities happen to sit in the generated CSS. A caller passing
+ // `px-2` against `inputSize="sm"`'s `px-2.5` lost, because `px-2` is emitted
+ // first; a caller passing `text-2xl` against `text-sm` won, because it is
+ // emitted later. Same call site, same shape of override, opposite outcomes.
+ //
+ // Found via the flow-canvas title, which had to stop using this component to
+ // get its own font size to stick. Every other primitive in `ui/` already
+ // composes through `cn` — this one was the outlier.
+ const classes = cn(
'w-full border bg-surface text-content placeholder-content-faint',
'transition-colors duration-150 focus:outline-hidden focus:ring-2',
'disabled:opacity-50 disabled:bg-surface-muted',
SIZES[inputSize],
ring,
- monospace ? 'font-mono' : '',
- className ?? '',
- ]
- .filter(Boolean)
- .join(' ');
+ monospace && 'font-mono',
+ className
+ );
return (
<input ref={ref} className={classes} {...rest} aria-invalid={invalid ? true : ariaInvalid} />
);