- 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
29 lines
538 B
Text
29 lines
538 B
Text
package ui
|
|
|
|
type TextareaProps struct {
|
|
ID string
|
|
Name string
|
|
Value string
|
|
Placeholder string
|
|
Rows int
|
|
Disabled bool
|
|
Required bool
|
|
Attrs templ.Attributes
|
|
}
|
|
|
|
templ Textarea(props TextareaProps) {
|
|
<textarea
|
|
id={ inputID(props.ID, props.Name) }
|
|
name={ props.Name }
|
|
placeholder={ props.Placeholder }
|
|
rows={ textareaRows(props.Rows) }
|
|
class="ui-textarea"
|
|
if props.Disabled {
|
|
disabled
|
|
}
|
|
if props.Required {
|
|
required
|
|
}
|
|
{ props.Attrs... }
|
|
>{ props.Value }</textarea>
|
|
}
|