el.xwx.moe/components/TextInput.tsx

39 lines
876 B
TypeScript
Raw Normal View History

2023-08-17 15:05:44 -05:00
import { ChangeEventHandler, KeyboardEventHandler } from "react";
type Props = {
autoFocus?: boolean;
value?: string;
type?: string;
placeholder?: string;
onChange: ChangeEventHandler<HTMLInputElement>;
onKeyDown?: KeyboardEventHandler<HTMLInputElement> | undefined;
className?: string;
2024-01-24 11:51:16 -06:00
spellCheck?: boolean;
2023-08-17 15:05:44 -05:00
};
export default function TextInput({
autoFocus,
value,
type,
placeholder,
onChange,
onKeyDown,
className,
2024-01-24 11:51:16 -06:00
spellCheck,
2023-08-17 15:05:44 -05:00
}: Props) {
return (
<input
2024-01-24 11:51:16 -06:00
spellCheck={spellCheck}
2023-08-17 15:05:44 -05:00
autoFocus={autoFocus}
type={type ? type : "text"}
placeholder={placeholder}
value={value}
onChange={onChange}
onKeyDown={onKeyDown}
2023-11-26 04:17:08 -06:00
className={`w-full rounded-md p-2 border-neutral-content border-solid border outline-none focus:border-primary duration-100 ${
2023-10-28 11:50:11 -05:00
className || ""
}`}
2023-08-17 15:05:44 -05:00
/>
);
}