Input
cubby-ui/inputFreeComponent
A input component.
Live preview
live · rendered by the registry
Rendered by cubby-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://cubby-ui.dev/r/input.jsonSource
1import * as React from "react";2import { cva, type VariantProps } from "class-variance-authority";3import { Input as BaseInput } from "@base-ui/react/input";45import { cn } from "@/lib/utils";67const inputVariants = cva(8 [9 "placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground",10 "border bg-clip-padding",11 "flex w-full min-w-0 rounded-lg",12 "text-base transition-colors duration-200 md:text-sm",13 "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-60",14 "file:text-foreground file:inline-flex file:h-7 file:rounded-md file:border-0 file:bg-transparent file:text-sm file:font-medium",15 "focus-visible:outline-ring/50 outline-0 outline-offset-0 outline-transparent transition-[outline-width,outline-offset,outline-color] duration-100 ease-out outline-solid focus-visible:outline-2 focus-visible:outline-offset-2",16 "aria-invalid:outline-destructive/50 aria-invalid:outline-2 aria-invalid:outline-offset-2 aria-invalid:outline-solid font-normal",17 ],18 {19 variants: {20 variant: {21 // Opaque bg — use on the page or any non-elevated substrate.22 default: "bg-input",23 // Translucent overlay — use inside Cards, Dialogs, or any elevated24 // surface where the opaque default would collapse into its parent.25 elevated: "bg-input-elevated",26 },27 size: {28 default: "h-10 px-3 py-2 sm:h-9",29 sm: "h-9 px-2.5 py-1.5 sm:h-8",30 },31 },32 defaultVariants: {33 variant: "default",34 size: "default",35 },36 },37);3839type InputProps = Omit<React.ComponentProps<typeof BaseInput>, "size"> &40 VariantProps<typeof inputVariants>;4142function Input({ className, size, variant, ...props }: InputProps) {43 return (44 <BaseInput45 data-slot="input"46 className={cn(inputVariants({ size, variant }), className)}47 {...props}48 />49 );50}5152export { Input, inputVariants, type InputProps };
What it pulls in
npm packages
Files it writes
More from cubby-ui
All 79 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | cubby-ui | Components | Free | 2 deps | |
| Alertalert | cubby-ui | Components | Free | 1 dep | |
| Alert-dialogalert-dialog | cubby-ui | Components | Free | 2 deps | |
| Aspect-ratioaspect-ratio | cubby-ui | Components | Free | no deps | |
| Autocompleteautocomplete | cubby-ui | Components | Free | 2 deps | |
| Avataravatar | cubby-ui | Components | Free | 1 dep | |
| Badgebadge | cubby-ui | Components | Free | 1 dep | |
| Base Drawerbase-drawer | cubby-ui | Components | Free | 2 deps |
