Files
gobeyhan/views/components/input.templ
Beyhan Oğur f34e54c5a5 first commit
2026-04-26 21:43:40 +03:00

28 lines
817 B
Plaintext

package components
type InputProps struct {
Label string
Name string
Type string
Placeholder string
Value string
Error string
}
templ Input(props InputProps) {
<div class="mb-4">
<label for={ props.Name } class="block text-sm font-medium text-gray-700 mb-1">{ props.Label }</label>
<input
type={ props.Type }
name={ props.Name }
id={ props.Name }
placeholder={ props.Placeholder }
value={ props.Value }
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm p-2 border"
/>
if props.Error != "" {
<p class="mt-1 text-sm text-red-600">{ props.Error }</p>
}
</div>
}