- input.css: .ui-input with min-height 44px, border-radius 0.75rem, focus ring - input.templ: InputProps with ID/Name/Type/Placeholder/Value/Disabled/Required/Attrs - textarea.css: .ui-textarea with min-height 7rem, resize vertical, focus ring - textarea.templ: TextareaProps with ID/Name/Value/Placeholder/Rows/Disabled/Required/Attrs - tailwind.input.css: add @import for input.css and textarea.css - All 7 TestInput/TestTextarea tests passing
30 lines
522 B
Text
30 lines
522 B
Text
package ui
|
|
|
|
type InputProps struct {
|
|
ID string
|
|
Name string
|
|
Value string
|
|
Placeholder string
|
|
Type string
|
|
Disabled bool
|
|
Required bool
|
|
Attrs templ.Attributes
|
|
}
|
|
|
|
templ Input(props InputProps) {
|
|
<input
|
|
id={ inputID(props.ID, props.Name) }
|
|
type={ inputType(props.Type) }
|
|
name={ props.Name }
|
|
value={ props.Value }
|
|
placeholder={ props.Placeholder }
|
|
class="ui-input"
|
|
if props.Disabled {
|
|
disabled
|
|
}
|
|
if props.Required {
|
|
required
|
|
}
|
|
{ props.Attrs... }
|
|
/>
|
|
}
|