Open History to see the last commit
1import { splitProps } from 'solid-js'
2import type { JSX } from 'solid-js'
3import { cn } from '@/utils'
4β
5type InputProps = JSX.HTMLElementTags['input']
6β
7/**
8 * A styled input field for collecting short text, numbers, files, and other
9 * native input values.
10 *
11 * @example
12 * ```tsx
13 * <Input type="email" placeholder="Email" />
14 * ```
15 */
16function Input(props: InputProps) {
17 const [local, others] = splitProps(props, ['class', 'type'])
18β
19 return (
20 <input
21 type={local.type}
22 data-slot="input"
23 class={cn(
24 'h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',
25 local.class,
26 )}
27 {...others}
28 />
29 )
30}
31β
32export { Input }