import { Input } from "@replicas/ui";

export default function InputDemo() {
  return (
    <div style={{ display: "flex", flexDirection: "column", gap: 20, width: 320 }}>
      <Input placeholder="Search by name" aria-label="Search by name" />
      <Input variant="flat" placeholder="Add description…" aria-label="Description" />
    </div>
  );
}

Examples

Sizes

<Input size="small" placeholder="Small" />
<Input size="medium" placeholder="Medium" />
<Input size="normal" placeholder="Normal" />
<Input size="large" placeholder="Large" />
<Input size="xlarge" placeholder="Xlarge" />

Disabled State

function DisabledState() {
  return <Input disabled placeholder="Read only" aria-label="Read only" />;
}

Invalid

function Invalid() {
  return <Input aria-invalid defaultValue="not-an-email" aria-label="Email" />;
}

Prompt

Copy Prompt hands your agent everything it needs to build the Input in the Linear style: the measured tokens, the CSS and the structure.

Show Prompt
# Linear Input

A native input element that automatically works with Field.

Build a Input in this project that looks and behaves like Linear's. Measured from the running Linear app (linear.app). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or [Base UI](https://base-ui.com/react/components/input) if it has none.

Fidelity: Measured from Linear's profile input, light and dark.

## Variants

- `size`: `small`, `medium`, `normal`, `large`, `xlarge`

## Tokens

| Token | Light | Dark |
| --- | --- | --- |
| `--text-faint` | `lch(66% 1 282)` | `lch(41.778% 1.425 272)` |
| `--input-bg` | `lch(100% 0 282)` | `lch(9.345% 0.85 272)` |
| `--input-border` | `lch(86.5% 0 282)` | `lch(31.01% 1.952 272.5)` |
| `--input-border-hover` | `lch(78.5% 0 282)` | `lch(30% 1.5 272)` |
| `--input-text` | `lch(10% 0 282)` | `lch(100% 0 272)` |
| `--focus-ring` | `#5e69d1` | `#5e69d1` |
| `--font-size-mini` | `0.75rem` | `0.75rem` |
| `--font-size-small` | `0.8125rem` | `0.8125rem` |
| `--font-size-regular` | `0.9375rem` | `0.9375rem` |
| `--font-weight-normal` | `450` | `450` |
| `--radius-control` | `8px` | `8px` |
| `--speed-highlight-fade-in` | `0s` | `0s` |
| `--speed-highlight-fade-out` | `0.15s` | `0.15s` |

## CSS

Scoped under `[data-style="linear"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.

```css
[data-style="linear"] {
  .ui-input {
    --input-ring-invalid: lch(56% 64 30);

    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin: 0;
    border: none;
    font-family: inherit;
    color: var(--input-text);
    outline: none;
    transition: border var(--speed-highlight-fade-out);

    &::placeholder {
      color: var(--input-placeholder, var(--text-faint));
    }

    &[data-disabled] {
      opacity: 0.5;
    }
  }

  &[data-theme="dark"] .ui-input {
    --input-ring-invalid: lch(62% 58 30);
    --input-placeholder: lch(39.447% 1.3 266.5);
  }

  .ui-input[data-variant="default"] {
    height: 32px;
    padding: 6px 12px;
    border: 0.5px solid var(--input-border);
    border-radius: var(--radius-control);
    background-color: var(--input-bg);
    font-size: var(--font-size-small);
    font-weight: 400;
    font-feature-settings: "calt" 0;

    @media (hover: hover) {
      &:hover:not([data-disabled], :focus-visible) {
        border-color: var(--input-border-hover);
        transition-duration: var(--speed-highlight-fade-in);
      }
    }

    &:focus-visible {
      outline: 1px solid var(--focus-ring);
      outline-offset: -1px;
    }

    &:is([data-invalid], [aria-invalid="true"]) {
      border-color: var(--input-ring-invalid);
    }

    &[data-size="small"] {
      height: 26px;
      font-size: var(--font-size-mini);
    }

    &[data-size="medium"] {
      height: 28px;
      font-size: var(--font-size-mini);
    }

    &[data-size="normal"] {
      height: 32px;
    }

    &[data-size="large"] {
      height: 44px;
      border-radius: 10px;
    }

    &[data-size="xlarge"] {
      height: 48px;
      border-radius: 10px;
    }
  }

  .ui-input[data-variant="flat"] {
    padding: 0;
    background-color: transparent;
    font-size: var(--font-size-regular);
    font-weight: var(--font-weight-normal);
    line-height: 24px;
    letter-spacing: -0.1px;
  }
}
```

## Structure

How Replicas assembles it on Base UI.

```tsx
import { Input as BaseInput } from "@base-ui/react/input";
import { join } from "./utils";

export type InputProps = Omit<BaseInput.Props, "className" | "size"> & {
  className?: string;
  variant?: string;
  size?: string;
};

export function Input({ className, variant = "default", size, ...props }: InputProps) {
  return <BaseInput className={join("ui-input", className)} data-variant={variant} data-size={size} {...props} />;
}
```

## Example

```tsx
import { Input } from "@replicas/ui";

export default function InputDemo() {
  return (
    <div style={{ display: "flex", flexDirection: "column", gap: 20, width: 320 }}>
      <Input placeholder="Search by name" aria-label="Search by name" />
      <Input variant="flat" placeholder="Add description…" aria-label="Description" />
    </div>
  );
}
```

## Foundations

The rest of the Linear style, as a skill: https://replicas.raphaelsalaja.com/skills/linear/SKILL.md