Buttons
Input Button
Animated button that transforms into an input field with smooth layout transitions. Perfect for React applications requiring dynamic form interactions with Next.js integration and TypeScript support.
Powered by
Installation
npx shadcn@latest add https://www.shadcn.io/registry/input-button.json
npx shadcn@latest add https://www.shadcn.io/registry/input-button.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/input-button.json
bunx shadcn@latest add https://www.shadcn.io/registry/input-button.json
Features
- Smooth layout transitions using Motion's layoutId for seamless button-to-input morphing
- Compound component pattern with provider, action, submit, and input components
- Loading state handling with built-in pending states and success feedback
- Accessible form integration supporting proper form submission and validation
- TypeScript support with complete interface definitions for all sub-components
- shadcn/ui integration using design tokens and consistent styling patterns
Examples
Loading States
Demonstrates form submission with loading indicators and success states.
Use Cases
This free open source React component works well for:
- Newsletter signups - Email collection with smooth interaction flow built with Next.js
- Search interfaces - Expandable search boxes using TypeScript and Tailwind CSS
- Quick actions - Compact forms that expand on demand for better UX
- CTA buttons - Call-to-action elements that transform into input forms
API Reference
InputButtonProvider
Prop | Type | Default | Description |
---|---|---|---|
showInput | boolean | false | Controls input visibility state |
setShowInput | function | - | State setter for input visibility |
transition | Transition | { type: 'spring', stiffness: 300, damping: 20 } | Motion transition configuration |
id | string | useId() | Unique identifier for layout animations |
InputButtonAction
Prop | Type | Default | Description |
---|---|---|---|
onClick | function | - | Click handler for button action |
children | ReactNode | required | Button text content |
InputButtonSubmit
Prop | Type | Default | Description |
---|---|---|---|
icon | React.ElementType | ArrowRight | Icon component for collapsed state |
children | ReactNode | - | Submit button text content |
disabled | boolean | false | Disables the submit button |
InputButtonInput
Prop | Type | Default | Description |
---|---|---|---|
type | string | "text" | HTML input type attribute |
placeholder | string | - | Input placeholder text |
value | string | - | Controlled input value |
onChange | function | - | Input change handler |
Implementation Notes
- Uses compound component pattern with context for state management
- Layout animations powered by Motion's layoutId system
- Automatic focus management when input appears
- Supports both controlled and uncontrolled usage patterns
- Compatible with shadcn/ui form components and validation
- Optimized for keyboard navigation and screen readers
Icon Button
Animated icon button with hover effects, customizable colors, and particle animations. Perfect for React applications requiring interactive button elements with Next.js integration and TypeScript support.
Liquid Button
Animated button with fluid fill effect and multiple variants. Perfect for React applications requiring smooth interactions with Next.js integration and TypeScript support.