Search
πŸ’‘

Input

Created
2026/01/17 05:35
Tags
2026/01/17 05:47

Context

shadcn/ui의 Sidebarμ—μ„œλŠ” Input μ»΄ν¬λ„ŒνŠΈλ₯Ό μ‚¬μš©ν•œλ‹€. 이 Input μ»΄ν¬λ„ŒνŠΈλŠ” μ‚¬μ΄λ“œλ°”μ— μ’…μ†λ˜λŠ” μ»΄ν¬λ„ŒνŠΈκ°€ μ•„λ‹Œ λ‹€λ₯Έ κ³³μ—μ„œλ„ λ²”μš©μ μœΌλ‘œ μ‚¬μš© 될 수 μžˆκΈ°μ— 뢄석과 이해가 ν•„μš”ν–ˆλ‹€.

Agenda

β€’
shadcn의 Input μ»΄ν¬λ„ŒνŠΈλ₯Ό λΆ„μ„ν•˜κ³  μ΄ν•΄ν•˜λŠ” 것을 λͺ©ν‘œλ‘œ 함

Contents

import { cn } from '@ui/lib/utils'; import type * as React from 'react'; function Input({ className, type, ...props }: React.ComponentProps<'input'>) { return ( <input type={type} data-slot='input' className={cn( 'file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base 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 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm', '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', className, )} {...props} /> ); } export { Input };
TypeScript
볡사
μœ„λŠ” shadcn/ui의 κΈ°λ³Έ Input μ»΄ν¬λ„ŒνŠΈμ΄λ‹€. input νƒœκ·Έμ—μ„œ μ‚¬μš©ν•˜λŠ” νŒŒλΌλ―Έν„°λ₯Ό κ·ΈλŒ€λ‘œ λ°›μ•„μ˜¬ 수 μžˆλ‹€. classNameμ—λŠ” μŠ€νƒ€μΌλ§κ³Ό κ΄€λ ¨ 된 속성듀이 μž…λ ₯이 λ˜μ–΄μžˆκ³ , aria-invalid을 ν™œμš©ν•˜μ—¬ 폼 κ²€μ¦μ‹œ μŠ€νƒ€μΌλ§μ„ μ œκ³΅ν•œλ‹€. selection μ„ νƒμžλŠ” λ“œλž˜κ·Έλ‚˜ 선택 μ‹œ 적용 λ˜λŠ” 속성이닀.