# UiInput (ui-input)

> Illustrated outlined text field with a placeholder bar and a cursor you switch on or off.

- Entry: component
- Category: UI Bits
- Preview capabilities: none (still preview)
- Runtime: React
- Needs Remotion: no
- QA page: https://jbm-ui.bns.studio/c/ui-input
- JSON: https://jbm-ui.bns.studio/catalog/ui-input.json
- Registry item: https://jbm-ui.bns.studio/r/ui-input.json (source code in files[].content)

## Install

```sh
npx shadcn@latest add @jbm/ui-input
```

Also installs @jbm/tokens, @jbm/paper (registry dependencies install automatically).

## Required setup

1. Add the `@jbm` registry to components.json (keep any entries already there):

   ```json
   {
     "registries": {
       "@jbm": "https://jbm-ui.bns.studio/r/{name}.json"
     }
   }
   ```

2. Map `@/*` to `./src/*` in tsconfig.json `compilerOptions.paths`, so `@/jbm/…` imports resolve to src/jbm/.

## Files

Each file's source code is in the registry item JSON (https://jbm-ui.bns.studio/r/ui-input.json, files[].content).

| Source path | Installs to | Import |
| --- | --- | --- |
| `registry/jbm/ui/ui-input.tsx` | `src/jbm/ui/ui-input.tsx` | `@/jbm/ui/ui-input` |

## API

### `UiInput` (component)

Cream paper field with an ink outline, a 3px ink cursor (half the height), and a line-colour placeholder bar at 45% of the width. It has no internal timer and no real text entry: blink the cursor by toggling `cursorOn` from a timeline.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `w` | `number` | `220` | Width in stage pixels, including the 2px Paper edge. |
| `h` | `number` | `70` | Height in stage pixels; sets the corner radius (22%), inner padding (28%), cursor height (50%), and placeholder thickness (12%, at least 6px). |
| `cursorOn` | `boolean` | `true` | Shows the cursor (opacity 1) when true, hides it (opacity 0) when false; the cursor keeps its space either way. |
| `style` | `React.CSSProperties` | none | Inline styles merged over the field's flex row; use for positioning or opacity. |

## Stage

Declared in stage pixels at the documented defaults.

| Orientation | Width | Height |
| --- | --- | --- |
| Landscape (1920×1080) | 220 | 70 |
| Vertical (1080×1920) | 220 | 70 |

Fixed w × h box (border-box) at the defaults 220 × 70. `w` and `h` set it directly; the Paper shadow extends below the box.

## Examples

### Field with the cursor showing

```tsx
import { UiInput } from "@/jbm/ui/ui-input"

<UiInput w={220} h={70} cursorOn />
```

### Blink the cursor on a Remotion timeline

```tsx
import { UiInput } from "@/jbm/ui/ui-input"
import { useSec } from "@/jbm/motion/hooks" // install @jbm/motion-hooks separately

// Render inside a Remotion <Composition> or <Player>: hooks run in the component body.
export function BlinkingInput() {
  const sec = useSec()
  return <UiInput w={420} h={120} cursorOn={Math.floor(sec * 2) % 2 === 0} />
}
```

## QA

- Toggle cursorOn: the cursor appears and disappears without shifting the placeholder bar.
- Check small and large h: padding, radius, and cursor scale with h while the placeholder floors at 6px thick.
- At narrow w with a tall h, confirm the placeholder bar and padding still fit inside the field (it does not clip its children).

## Family

Interface bits

## Related

Installs:

- [Tokens (tokens)](https://jbm-ui.bns.studio/catalog/tokens.md)
- [Paper (paper)](https://jbm-ui.bns.studio/catalog/paper.md)

Installed by:

- [Piece (piece)](https://jbm-ui.bns.studio/catalog/piece.md)

Bundled in:

- [UiBits (ui-bits)](https://jbm-ui.bns.studio/catalog/ui-bits.md)

Imported in examples:

- [MotionHooks (motion-hooks)](https://jbm-ui.bns.studio/catalog/motion-hooks.md)

## More

- [llms.txt](https://jbm-ui.bns.studio/llms.txt): index of every item
- [catalog.json](https://jbm-ui.bns.studio/catalog.json): every item as JSON
- [Agent contract](https://jbm-ui.bns.studio/docs/agent-contract.md): what each field means
