Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

Input.tsx

28 lines659 Bytes

1import * as React from 'react'
2import { type inputVariantProps, inputVariants } from './variants'
3​
4type InputProps = React.InputHTMLAttributes<HTMLInputElement> &
5 Omit<inputVariantProps, 'type'> & {
6 invalid?: boolean
7 }
8​
9const Input = React.forwardRef<HTMLInputElement, InputProps>(
10 ({ className, type, invalid = false, ...props }, ref) => {
11 return (
12 <input
13 className={inputVariants({
14 className,
15 type,
16 invalid,
17 } as inputVariantProps)}
18 type={type}
19 ref={ref}
20 {...props}
21 />
22 )
23 },
25​
26Input.displayName = 'Input'
27​
28export { Input, inputVariants, type InputProps }