reed-hunt-input

The input field nobody asked for

Digits fly up out of the reeds. Shoot one and it lands in the next slot. The red cross erases the last digit. You get 20% more ammo than you need. Run out and the free ammo is over, but for just €1 you can top up, and the marsh gets gloomier. On the last level the ammo comes back on its own. Something else comes too. Also works as a CAPTCHA, if you squint.

value: ""

Install

npm i reed-hunt-input

React

import { ReedHuntInput, reedHuntFormats } from 'reed-hunt-input/react';

const [card, setCard] = useState('');

<ReedHuntInput
  format={reedHuntFormats.card}
  value={card}
  onValueChange={setCard}
/>

Vue

import { ReedHuntInput, reedHuntFormats } from 'reed-hunt-input/vue';

<ReedHuntInput
  v-model="pin"
  :format="reedHuntFormats.pin"
  @complete="unlock"
/>

Plain JS

import { createReedHunt, reedHuntFormats } from 'reed-hunt-input';

createReedHunt(document.querySelector('#amount'), {
  format: reedHuntFormats.amount,
  onChange: (digits) => console.log(digits),
});

Your styles

Built-in styles sit in a cascade layer, so plain CSS like this wins without a fight.

.soft {
  --rh-accent: #7c3aed;
  --rh-accent-soft: #ede9fe;
  --rh-radius: 12px;
  --rh-stage-border: 0;
  --rh-stage-shadow: 0 12px 32px rgb(76 29 149 / 0.25);
  --rh-font-mono: 'Inter', sans-serif;
}
.soft .rh-slot[data-state='filled'] {
  border-color: #7c3aed;
  background: #f5f3ff;
}

createReedHunt(el, {
  format: reedHuntFormats.pin,
  classNames: { root: 'soft' },
});