-
Notifications
You must be signed in to change notification settings - Fork 0
/
select.templ
40 lines (38 loc) · 1.15 KB
/
select.templ
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package appkit
type SelectProps struct {
ID string
Label string
Disabled string
Error string
Value string
XModel string
XBindError string
XBindLabel string
XBindValue string
OnChange string
}
templ Select(props *SelectProps) {
<div class="flex flex-col group">
if props.Label != "" || props.XBindLabel != "" {
@InputLabel(&InputLabelProps{ID: props.ID, Label: props.Label, XBindLabel: props.XBindLabel})
}
<select
id={ props.ID }
class="pl-2 py-1.5 border border-neutral-200 hover:enabled:border-neutral-300 w-full rounded-md text-neutral-800 text-base pr-9 outline-none tracking-tight ui-select focus:border-workspace-accent group-hover:focus:border-workspace-accent focus:shadow-active disabled:bg-neutral-50 focus:ring-0 focus:ring-offset-0"
if props.Disabled != "" {
:disabled={ props.Disabled }
}
if props.XModel != "" {
x-model={ props.XModel }
}
if props.OnChange != "" {
@change={ props.OnChange }
}
>
{ children... }
</select>
if errorText := GetError(&ErrorProps{XBindError: props.XBindError, Error: props.Error}); errorText != "" {
@InputError(errorText)
}
</div>
}