Created
July 8, 2020 22:54
-
-
Save merelinguist/bd9b9ae348df85a9ea18dafc3008fbb9 to your computer and use it in GitHub Desktop.
React implementation of TailwindUI Buttons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ExclamationCircle } from "heroicons-react"; | |
import { InputHTMLAttributes } from "react"; | |
import { toKebabCase } from "utils/string/toKebabCase"; | |
type InputProps = { | |
hint?: string; | |
hideLabel?: boolean; | |
label: string; | |
error?: string; | |
help?: string; | |
} & InputHTMLAttributes<HTMLInputElement>; | |
export const Input = ({ | |
className, | |
hint, | |
id, | |
hideLabel, | |
label, | |
error, | |
type, | |
placeholder, | |
onChange, | |
value, | |
help, | |
}: InputProps) => ( | |
<div className={className}> | |
<div className={hint && "flex justify-between"}> | |
<label | |
htmlFor={id} | |
className={`block text-sm font-medium leading-5 text-gray-700 ${ | |
hideLabel && "sr-only" | |
}`} | |
> | |
{label} | |
</label> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment