Skip to content

Instantly share code, notes, and snippets.

@merelinguist
Created July 8, 2020 22:54
Show Gist options
  • Save merelinguist/bd9b9ae348df85a9ea18dafc3008fbb9 to your computer and use it in GitHub Desktop.
Save merelinguist/bd9b9ae348df85a9ea18dafc3008fbb9 to your computer and use it in GitHub Desktop.
React implementation of TailwindUI Buttons
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