Input
Text field with a visible label, optional icons, an error that shakes once, and a success check that draws in.
- Category: Inputs
- Licence: Free, MIT
- Built with: React 19, Tailwind CSS 4, Motion
- Dependencies: motion, clsx, tailwind-merge
Examples
Input
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | |
hint | ReactNode | — | Helper text under the field. |
error | string | — | Shakes the field once and announces the message. |
success | boolean | — | Draws a check on the right. |
leading | ReactNode | — | Icon on the left. |
...props | ComponentProps<"input"> | — |
About Input
Input is a text field with the states a real form needs, each animated with care: an error that shakes once and announces itself, a success check that draws in, helper text, and an optional leading icon. It always keeps a visible label.
Input is an input component for React 19, styled with Tailwind CSS 4 and animated with Motion. It drops into Next.js, Vite, Remix or Astro through the shadcn CLI as a single file you own.
When to use Input
- Sign-up and login forms.
- Settings fields with validation feedback.
- Search and filter inputs with a leading icon.
- Any form where errors should be noticed without being alarming.
How it works
The error shake runs once when the error appears, not on every render, and the message is connected with aria-describedby so screen readers read it. The success check is an SVG path that draws in; everything else is a normal input element with all its props.
It is a real form control: it has an accessible name, works with the keyboard alone, shows a visible focus ring and announces its state to screen readers. With prefers-reduced-motion on, it holds still or settles instantly instead of animating.
Customizing Input
Every prop is documented in the API reference above with its type and default. The ones you will reach for first are listed here.
The Customize panel next to the preview lets you change label, placeholder, hint, disabled live, and the Code tab updates to match, so the snippet you copy already carries your values.
- label (string).
- hint (ReactNode): Helper text under the field.
- error (string): Shakes the field once and announces the message.
- success (boolean): Draws a check on the right.
- leading (ReactNode): Icon on the left.
Goes well with Input
Input is already composed into 3 ready-made sections, so you can see it in context or install the whole block.
- Pricing Enterprise: Pricing section
- CTA Steps: CTA section
- Contact Form: Contact section
- Range Slider: Six animated React range sliders on one accessible core: inline, tick, fluid, wave, bubble and ruler
- Button: An animated React button with six variants, spring press feedback and a width-stable loading state
- Switch: An animated React toggle switch whose thumb stretches when pressed, like a real switch
- Checkbox: An animated React checkbox: the check draws itself in, the box pops, indeterminate morphs to a dash
- Radio Group: An animated React radio group with roving focus and a highlight that glides between card options
Install Input
npx shadcn@latest add https://charcoalui.com/r/input.jsonInput is free and MIT licensed. The command copies input.tsx into components/ui and installs clsx, tailwind-merge; you can also copy the source from the Code tab by hand.
It pairs well with Clear Input, a Pro piece: A search field whose clear button dissolves the text word by word instead of blanking it.
Frequently asked questions
- Does it support every native input prop?
- Yes. Type, name, autoComplete, required and the rest pass straight through to the input element, so it works with any form library.
- How do I install Input?
- Run npx shadcn@latest add https://charcoalui.com/r/input.json. The shadcn CLI copies input.tsx into components/ui and installs motion, clsx, tailwind-merge. You can also copy the source from this page by hand.
- Is Input free for commercial use?
- Yes. Input is MIT licensed: use it in any personal or commercial project and change it however you like.
- Does Input work with Next.js?
- Yes. It is a client component for React 19 styled with Tailwind CSS 4, so it works in the Next.js App Router and Pages Router, Vite, Remix and Astro.
- Can an AI coding agent install Input?
- Yes. Connect the Charcoal UI MCP server (https://charcoalui.com/mcp) to Claude Code, Cursor or any MCP client; get_component returns Input's props and source and get_install_command returns the exact command.