Input

A text input field with multiple variants, sizes, and states

Installation#

npmpnpmyarnbun
npx sugarcoat add input

Examples#

Default#

Default

Sizes#

Available in four sizes to fit different UI contexts.

Sizes

Variants#

The Input component supports several visual variants.

Variants

Validation States#

Use the state prop to indicate validation status.

States

With Icons#

Inputs can include icons before or after the text field.

With Icons

Shadow#

Add elevation with the shadow prop.

Shadow

Block Width#

By default, inputs span the full width. Use block={false} to make them inline.

Block Width

Disabled State#

Disabled

Input Types#

The Input component supports all native input types.

Input Types

Controlled Input#

Controlled

Usage#

Import
import { Input } from "@sugarcoat/ui-nxt";
Usage
<Input 
placeholder="Enter text" 
size="md" 
variant="default"
state="valid"
/>

Props#

PropTypeDefaultDescription
size"xs" | "sm" | "md" | "lg""md"Size of the input
variant"default" | "outline" | "ghost" | "glass""default"Visual style variant
state"valid" | "invalid"-Validation state of the input
shadow"none" | "sm" | "md" | "lg" | "inset""sm"Box shadow elevation
blockbooleantrueWhether the input spans full width
animationbooleantrueEnable transition animations
leftIconReactNode-Icon to display before the input
rightIconReactNode-Icon to display after the input
wrapperClassNamestring-Additional class name for the wrapper element
disabledbooleanfalseWhether the input is disabled
cssSystemStyleObject-Additional CSS styles using Panda CSS syntax

Accessibility#

  • Uses native <input> element for full accessibility support
  • Supports keyboard navigation and focus management
  • Disabled state properly communicated to assistive technologies
  • Use with <Label> component for accessible form labels
  • Validation states should be accompanied by error messages for screen readers
Customize Theme
Build your own sugarcoat/ui theme
PresetLime / Violet / Slate
Brand ColorLime
Accent ColorViolet
Gray ScaleSlate
Border RadiusLg