Rendyn

Component library

189 components

Interaction

Input

The animated Input wraps a native input while exposing a string-valued change callback and error presentation.

Interactive exampleReact Tailwind CSS

Practical React example

Collect a project name with a visible label and a useful validation message.

Before you copy and paste

Keep the example in the React rendering environment required by the imported component. Copy components/motion/input.tsx and its returned support files from the Code tab; preserve the project-relative paths.

Listed package dependencies: clsx, lucide-react, motion, react, tailwind-merge.

Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.

Collect a project name with a visible label and a useful validation message

// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";

import { Eye, EyeOff, Mail, Search } from "lucide-react";
import { useState } from "react";
import { Input } from "@/components/motion/input";

export function InputPreview() {
  const [email, setEmail] = useState("");
  const [pass, setPass] = useState("hunter2");
  const [query, setQuery] = useState("Ada");
  const [show, setShow] = useState(false);

  const emailError =
    email.length > 0 && !email.includes("@") ? "Enter a valid email address." : undefined;

  return (
    <div className="flex w-full max-w-xs flex-col gap-1">
      <Input
        label="Email"
        type="email"
        placeholder="you@example.com"
        leftIcon={<Mail />}
        value={email}
        onChange={setEmail}
        error={emailError}
        reserveErrorLine
      />
      <Input
        label="Password"
        type={show ? "text" : "password"}
        value={pass}
        onChange={setPass}
        rightIcon={
          <button
            type="button"
            onClick={() => setShow((s) => !s)}
            aria-label={show ? "Hide password" : "Show password"}
            className="pointer-events-auto"
          >
            {show ? <EyeOff /> : <Eye />}
          </button>
        }
        reserveErrorLine
      />
      <Input
        label="Search"
        leftIcon={<Search />}
        value={query}
        onChange={setQuery}
        success={query.length > 1}
        reserveErrorLine
      />
    </div>
  );
}

Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.

The imported onChange receives the value string rather than a DOM event. Keep field state in the parent and derive error and success from your validation result.

Customization

InputProps.label
Optional; string.
InputProps.value
Optional; string.
InputProps.defaultValue
Optional; string.
InputProps.onChange
Optional; (value: string) => void.
InputProps.error
Optional; string | boolean. Truthy error triggers a shake, red border and (if a string) a message.
InputProps.reserveErrorLine
Optional; boolean. Reserve one message line so validation does not shift nearby content.
InputProps.success
Optional; boolean.
InputProps.leftIcon
Optional; ReactNode.
InputProps.rightIcon
Optional; ReactNode.
InputProps.className
Optional; string.
InputProps.classNames
Optional; InputClassNames.

Integration notes

  • Client validation helps correction but does not replace server-side checks.
  • Keep the error associated with the field and avoid marking untouched fields as successful.

Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.

Better with your agent

Give your agent taste.

The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.

All components are free. Sign up only to connect MCP.

Connect to MCP