Input DaisyUI

Text fields using DaisyUI's input and fieldset classes.

Default

go
@daisyui.Input(daisyui.InputProps{
    Label:       "Email",
    Type:        "email",
    Placeholder: "you@example.com",
})

Variants

go
@daisyui.Input(daisyui.InputProps{Label: "Primary", Variant: daisyui.InputPrimary, Placeholder: "input-primary"})
@daisyui.Input(daisyui.InputProps{Label: "Success", Variant: daisyui.InputSuccess, Placeholder: "input-success"})
@daisyui.Input(daisyui.InputProps{Label: "Warning", Variant: daisyui.InputWarning, Placeholder: "input-warning"})

Error state

Please enter a valid email address.

go
@daisyui.Input(daisyui.InputProps{
    Label: "Email",
    Type:  "email",
    Error: "Please enter a valid email address.",
})

Sizes

go
@daisyui.Input(daisyui.InputProps{Placeholder: "XS", Size: daisyui.InputSizeXS})
@daisyui.Input(daisyui.InputProps{Placeholder: "SM", Size: daisyui.InputSizeSM})
@daisyui.Input(daisyui.InputProps{Placeholder: "MD (default)"})
@daisyui.Input(daisyui.InputProps{Placeholder: "LG", Size: daisyui.InputSizeLG})

Props

PropTypeDefaultDescription
Label string""Label text above the input
Type string"text"HTML input type
Placeholder string""Placeholder text
Value string""Initial value
Variant InputVariant""input-primary, input-secondary, input-accent, input-error, input-warning, input-success, input-info
Size InputSize""input-xs, input-sm, (default md), input-lg, input-xl
Error string""Error message — also applies input-error styling
Helper string""Helper text below the input (shown when no error)
Required boolfalseMarks field as required with * indicator
Disabled boolfalseDisables the input
Attrs templ.AttributesnilSpread any HTML attribute