Input
fysk/inputFreeComponent
Displays a form input field that handles state for you.
Install it
npx shadcn@latest add https://fysk.dev/r/input.jsonSource
1"use client"23import * as React from "react"4import { cva, type VariantProps } from "class-variance-authority"5import { cn } from "@/lib/utils"6import { useFyskConfig, type FyskIconPosition } from "@/components/fysk-provider"7import { useFyskAnimation } from "@/components/hooks/useFyskAnimation"89const inputVariants = cva(10 "flex w-full min-w-0 rounded-md shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",11 {12 variants: {13 variant: {14 default: "border border-input bg-transparent dark:bg-input/30 shadow-xs",15 outline: "border-2 border-border bg-transparent focus:border-ring/50",16 secondary: "border border-transparent bg-muted focus:bg-background focus:border-input",17 ghost: "border border-transparent bg-transparent hover:bg-muted focus:bg-background shadow-none",18 glass: "bg-foreground/5 backdrop-blur-md border border-border/50 text-foreground placeholder:text-muted-foreground/50 focus:bg-foreground/10 shadow-xs",19 },20 size: {21 xs: "h-7 px-2 py-1 text-xs",22 sm: "h-8 px-2.5 py-1 text-sm",23 md: "h-9 px-3 py-1 text-base md:text-sm",24 lg: "h-10 px-4 py-2 text-base md:text-sm",25 xl: "h-12 px-5 py-3 text-lg",26 },27 },28 defaultVariants: {29 variant: "default",30 size: "md",31 },32 }33)3435export interface InputProps36 extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>,37 VariantProps<typeof inputVariants> {38 state?: "idle" | "loading" | "success" | "error"39 icon?: React.ReactNode40 iconLoading?: React.ReactNode41 iconSuccess?: React.ReactNode42 iconError?: React.ReactNode43 iconPosition?: FyskIconPosition44 onIconClick?: (e: React.MouseEvent<HTMLButtonElement>) => void45}4647const Input = React.forwardRef<HTMLInputElement, InputProps>(48 (49 {50 className,51// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from fysk
All 18 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Avataravatar | fysk | Components | Free | 2 deps | |
| Badgebadge | fysk | Components | Free | 1 dep | |
| Buttonbutton | fysk | Components | Free | 2 deps | |
| Empty Stateempty | fysk | Components | Free | 2 deps | |
| Formform | fysk | Components | Free | 4 deps | |
| fysk-providerfysk-provider | fysk | Components | Free | 2 deps | |
| Input OTPinput-otp | fysk | Components | Free | no deps | |
| Kbdkbd | fysk | Components | Free | 1 dep |
