first commit
This commit is contained in:
27
views/components/input.templ
Normal file
27
views/components/input.templ
Normal file
@@ -0,0 +1,27 @@
|
||||
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>
|
||||
}
|
||||
Reference in New Issue
Block a user