driftkit
ComponentsInput

Input

Motion-first input with floating labels, state-aware styling, error shake animation, and focus rings. Supports success states with checkmark animation.

Input

Installation

Copy and paste

Copy the component source code and paste it into your project.

import { Input } from "driftkit";

Props

NameTypeRequiredDescription
labelstringNoFloating label that animates up when focused or filled. Provides accessible labeling.
size"sm" | "md" | "lg"NoInput size affecting padding, text size, and label positioning.
state"default" | "error" | "success"NoVisual state. Error shows red border and shake animation. Success shows green border and checkmark.
errorMessagestringNoError message displayed below input when state is 'error'. Animates in/out smoothly.
🎮

Playground

Tune spring physics for this component

Live Preview

Input Component

Spring Physics

300
30
1

Generated Code

const springConfig = {
  "type": "spring",
  "stiffness": 300,
  "damping": 30,
  "mass": 1
};

// Basic hover animation
<motion.div
  whileHover={{ scale: 1.05 }}
  whileTap={{ scale: 0.95 }}
  transition={springConfig}
>
  <Input />
</motion.div>

// Advanced with custom animations
<motion.div
  animate={{ 
    scale: [1, 1.02, 1],
    y: [0, -4, 0]
  }}
  transition={{
    ...springConfig,
    repeat: Infinity,
    repeatDelay: 2
  }}
>
  <Input />
</motion.div>
Stiffness: Controls animation speed. Higher values create snappier animations.
Damping: Controls resistance to motion. Lower values create more bounce and overshoot.
Mass: Controls the perceived weight. Higher values make animations slower with more momentum.

Source Code

View the source code on GitHub to see the full implementation.

View on GitHub