GitHub
Open Github

Exploding Input

Input component that spawns particle effects when typing.

Installation

pnpm dlx shadcn@latest add @spell/exploding-input

Usage

import { ExplodingInput } from "@/components/exploding-input";
<label className="block">
  <input
    type="text"
    placeholder="try@spell.here"
    className="w-72 p-0 h-10 text-base border-b bg-background font-medium placeholder:font-medium outline-none"
  />
  <ExplodingInput
  className="z-50"
    content={[
      <span key="1" className="text-4xl">🤩</span>,
      <span key="2" className="text-4xl">👾</span>,
      <span key="3" className="text-4xl">😺</span>,
      <span key="4" className="text-4xl">👻</span>,
      <span key="5" className="text-4xl">🎃</span>,
      <span key="6" className="text-4xl">🖤</span>,
      <span key="7" className="text-4xl">🗯️</span>,
    ]}
    direction={{ horizontal: "left", vertical: "top" }}
    gravity={0.5}
    duration={3}
    count={3}
  />
</label>

Props

PropTypeDefault
content
ReactNode[]
[]
count
number
1
direction
{ horizontal, vertical }
{ horizontal: 'center', vertical: 'top' }
gravity
number
0.7
duration
number
3
scale
{ value, randomize, randomVariation }
{ value: 1 }
rotation
{ value, animate }
{ value: 0 }
className
string
-
style
CSSProperties
-

Inspiration