A Memphis-style input component with conditional shadow support and dotted border states on focus.
Focus to see dotted border effect
Focus: dotted border + shadow moves
Install the Input component using the shadcn CLI:
npx shadcn@latest add https://memphi.dev/r/input.json
Prerequisites: Make sure you have completed the installation setup before adding components.
Prop | Type | Default | Description |
---|---|---|---|
variant | "default" | "destructive" | "success" | "warning" | "default" | The visual style variant |
size | "sm" | "default" | "lg" | "default" | The size of the input |
shadowColor | string | undefined | Color for the shadow. If provided, shadow is applied |
className | string | - | Additional CSS classes |
Note: The Input component extends all standard HTML input attributes except size
(which conflicts with our variant size).
shadowColor
is provided → Shadow is appliedshadowColor
→ No shadow, only border transitionsbox-shadow
with the specified colorimport * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const inputVariants = cva(
[
// Base styles
"flex h-10 w-full rounded-md border-2 border-black bg-white px-3 py-2",
"text-sm text-black placeholder:text-gray-500",
"transition-all duration-200 ease-in-out",
"disabled:cursor-not-allowed disabled:opacity-50",
"file:border-0 file:bg-transparent file:text-sm file:font-medium",
// Focus styles with dotted border
"focus:outline-none focus:border-dashed focus:border-2",
// Invalid styles
// ... (click expand to see more)
Make sure you have the required dependencies installed and the utility function available:
npm install class-variance-authority clsx tailwind-merge