Skip to content

Input

A single line field with clear labels and useful states.

FieldForm
npx shadcn@latest add @silicon-ui/input

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/input

Manually

  1. Install the dependencies

    npm install motion
  2. Copy these files into your project

    • components/silicon-ui/input/input.tsx
    • components/silicon-ui/input/input.module.css
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { Input } from "@/components/silicon-ui/input/input";

API reference

PropTypeDefault
label*string—
prefix

Fixed text or an icon inside the field before what is typed (a currency, "c:"). It takes the typed text's size and a quieter colour, with no gap: the value reads as one word with it.

ReactNode—
suffix

An icon or short text inside the field after what is typed (a status icon, a unit).

ReactNode—
description

Plain text animates word by word when it changes; markup (a bold id) is shown as given.

ReactNode—
errorstring—

Also accepts the props of InputHTMLAttributes<HTMLInputElement>, except prefix.

Dependencies

npm
motion
Registry
silicon-motion-tokens