Skip to content
Components

Input

Input with thoughtful defaults, semantic styling, and editable source.

Open ↗

Make it yours.

Install the editable source and its dependencies into your React + Tailwind project.

Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/input.json

Use it

Scroll horizontally for long lines
"use client";
import {FormField} from '@/components/jez-ui/ui/form-field';
import {Input} from '@/components/jez-ui/ui/input';

export default function Example(){

return <><div className="grid w-full max-w-sm gap-6"><h3 className="text-2xl">Give it a name.</h3><FormField label="Project name" hint="You can change this whenever you like."><Input placeholder="e.g. The next chapter"/></FormField><FormField label="Workspace URL"><div className="flex items-center rounded-lg border border-border px-3"><span className="shrink-0 whitespace-nowrap text-sm text-muted-foreground">studio.app /</span><Input className="border-0 bg-transparent shadow-none focus-visible:ring-0" aria-label="Workspace slug" defaultValue="field-notes"/></div></FormField></div></>;
}

Props & types

Scroll horizontally for long lines
React.ComponentProps<"input">

Source

View 2 source files

registry/ui/input.tsx

Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function Input({ className, ...props }: React.ComponentProps<"input">) {
  return (
    <input
      className={cn(
        "block h-10 w-full min-w-0 rounded-lg border border-border bg-background px-3 text-sm leading-normal shadow-[0_1px_2px_#00000004] transition-[border-color,box-shadow] placeholder:text-muted-foreground/75 hover:border-foreground/25 focus:border-primary focus:outline-none focus:ring-3 focus:ring-primary/10 aria-invalid:border-danger aria-invalid:ring-danger/10 disabled:cursor-not-allowed disabled:bg-muted/50 disabled:opacity-50",
        className,
      )}
      {...props}
    />
  );
}

registry/ui/utils.ts

Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
  return twMerge(clsx(values));
}

Dependencies

clsx@2.1.1 · tailwind-merge@3.5.0

Accessibility & behaviour

Provide meaningful labels and preserve keyboard focus styles. Check contrast when customising theme colours.

Read the accessibility and performance guide →