import { type JSX, splitProps } from "solid-js"; export interface InputProps extends JSX.InputHTMLAttributes { label?: string; error?: string; helperText?: string; ref?: HTMLInputElement | ((el: HTMLInputElement) => void); containerClass?: string; } export default function Input(props: InputProps) { const [local, others] = splitProps(props, [ "label", "error", "helperText", "ref", "containerClass" ]); const containerClasses = ["input-group", local.containerClass] .filter(Boolean) .join(" "); return (
{local.label && } {local.error && ( {local.error} )} {local.helperText && !local.error && ( {local.helperText} )}
); }