Sabil UI

Search documentation

Search for a command to run...

Components

Input

Displays a form input field or a component that looks like an input field.

Your API key is encrypted and stored securely.

Installation#

  1. Install the dependencies

    npm install cn
  2. Copy the source into your project

    components/ui/input.tsx
    import * as React from "react"import { cn } from "cn"function Input({ className, type, ...props }: React.ComponentProps<"input">) {  return (    <input      type={type}      data-slot="input"      className={cn(        "h-10 w-full min-w-0 rounded-lg border border-input bg-background px-3 py-1 text-base shadow-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",        className      )}      {...props}    />  )}export { Input }
  3. Make sure the foundation is in place

    Components read their colors, radius and surfaces from the tokens in app/globals.css. See Theming.

Usage#

import { Input } from "@/components/ui/input"

Examples#

Badge

Basic

Button Group

Disabled

This field is currently disabled.

Field

Choose a unique username for your account.

Fieldgroup

We'll send updates to this address.

File

Select a picture to upload.

Form

We'll never share your email with anyone.

Grid

Inline

Input Group

https://

Invalid

This field contains validation errors.

Required

This field must be filled out.