Documentation
¶
Overview ¶
Package input provides input components for forms.
Index ¶
- func Field(labelText string, inputOpts []Option, children ...g.Node) g.Node
- func FormDescription(text string) g.Node
- func FormError(text string) g.Node
- func Input(opts ...Option) g.Node
- func InputGroup(opts []GroupOption, children ...g.Node) g.Node
- func InputGroupAddon(opts []AddonOption, children ...g.Node) g.Node
- func InputGroupButton(children g.Node, opts ...GroupButtonOption) g.Node
- func InputGroupInput(opts ...GroupInputOption) g.Node
- func InputGroupText(text string, opts ...func(*textProps)) g.Node
- func InputGroupTextarea(opts ...GroupTextareaOption) g.Node
- func InputLeftAddon(opts []AddonOption, children ...g.Node) g.Nodedeprecated
- func InputLeftElement(opts []ElementOption, children ...g.Node) g.Nodedeprecated
- func InputRightAddon(opts []AddonOption, children ...g.Node) g.Nodedeprecated
- func InputRightElement(opts []ElementOption, children ...g.Node) g.Nodedeprecated
- func SearchInput(opts ...Option) g.Node
- func WithTextClass(class string) func(*textProps)
- type AddonOption
- type AddonProps
- type Alignment
- type ElementOption
- type ElementProps
- type GroupButtonOption
- func WithGroupButtonAttrs(attrs ...g.Node) GroupButtonOption
- func WithGroupButtonClass(class string) GroupButtonOption
- func WithGroupButtonSize(size GroupButtonSize) GroupButtonOption
- func WithGroupButtonType(t string) GroupButtonOption
- func WithGroupButtonVariant(v forgeui.Variant) GroupButtonOption
- type GroupButtonProps
- type GroupButtonSize
- type GroupInputOption
- func GroupInputDisabled() GroupInputOption
- func GroupInputInvalid() GroupInputOption
- func GroupInputRequired() GroupInputOption
- func WithGroupInputAttrs(attrs ...g.Node) GroupInputOption
- func WithGroupInputClass(class string) GroupInputOption
- func WithGroupInputID(id string) GroupInputOption
- func WithGroupInputName(name string) GroupInputOption
- func WithGroupInputPlaceholder(placeholder string) GroupInputOption
- func WithGroupInputType(t string) GroupInputOption
- func WithGroupInputValue(value string) GroupInputOption
- type GroupInputProps
- type GroupOption
- type GroupProps
- type GroupTextareaOption
- func GroupTextareaDisabled() GroupTextareaOption
- func GroupTextareaInvalid() GroupTextareaOption
- func GroupTextareaRequired() GroupTextareaOption
- func WithGroupTextareaAttrs(attrs ...g.Node) GroupTextareaOption
- func WithGroupTextareaClass(class string) GroupTextareaOption
- func WithGroupTextareaID(id string) GroupTextareaOption
- func WithGroupTextareaName(name string) GroupTextareaOption
- func WithGroupTextareaPlaceholder(placeholder string) GroupTextareaOption
- func WithGroupTextareaRows(rows int) GroupTextareaOption
- func WithGroupTextareaValue(value string) GroupTextareaOption
- type GroupTextareaProps
- type Option
- func Disabled() Option
- func Invalid() Option
- func Required() Option
- func WithAttrs(attrs ...g.Node) Option
- func WithClass(class string) Option
- func WithID(id string) Option
- func WithName(name string) Option
- func WithPlaceholder(placeholder string) Option
- func WithType(t string) Option
- func WithValue(value string) Option
- func WithVariant(v forgeui.Variant) Option
- type Props
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormDescription ¶
FormDescription creates a form field description
func Input ¶
Input creates an input field following shadcn/ui patterns
Example:
input.Input(
input.WithPlaceholder("Enter email"),
input.WithType("email"),
input.WithName("email"),
)
With error state:
input.Input(
input.WithPlaceholder("Enter email"),
input.Invalid(), // Shows error styling via aria-invalid
)
func InputGroup ¶
func InputGroup(opts []GroupOption, children ...g.Node) g.Node
InputGroup creates a group of inputs with addons or positioned elements.
This follows the shadcn/ui input-group pattern with support for: - Inline addons (inline-start, inline-end) - Block addons (block-start, block-end) - Focus and error states - Disabled state
Example with inline addons:
input.InputGroup(
[]input.GroupOption{},
input.InputGroupAddon(
[]input.AddonOption{input.WithAddonAlign(input.AlignInlineStart)},
icons.Mail(),
),
input.InputGroupInput(input.WithPlaceholder("Enter email")),
)
Example with button:
input.InputGroup(
[]input.GroupOption{},
input.InputGroupInput(input.WithPlaceholder("Search...")),
input.InputGroupAddon(
[]input.AddonOption{input.WithAddonAlign(input.AlignInlineEnd)},
input.InputGroupButton(
g.Text("Search"),
input.WithGroupButtonSize(input.GroupButtonSizeSM),
),
),
)
func InputGroupAddon ¶
func InputGroupAddon(opts []AddonOption, children ...g.Node) g.Node
InputGroupAddon creates an addon container for icons, text, or buttons.
Supports four alignment positions: - inline-start: Left side of the input (default) - inline-end: Right side of the input - block-start: Above the input (stacked layout) - block-end: Below the input (stacked layout)
Example:
input.InputGroupAddon(
[]input.AddonOption{input.WithAddonAlign(input.AlignInlineStart)},
icons.Search(),
)
func InputGroupButton ¶
func InputGroupButton(children g.Node, opts ...GroupButtonOption) g.Node
InputGroupButton creates a button styled for use inside input groups.
Uses ghost variant by default with smaller sizing options appropriate for input groups.
Example:
input.InputGroupButton(
g.Text("Search"),
input.WithGroupButtonSize(input.GroupButtonSizeXS),
)
func InputGroupInput ¶
func InputGroupInput(opts ...GroupInputOption) g.Node
InputGroupInput creates an input styled for use inside input groups.
This input removes its own border and shadow since the parent InputGroup handles those. Note: You can also use the regular Input() component inside InputGroup - it will be styled automatically.
Example:
input.InputGroupInput(
input.WithGroupInputPlaceholder("Enter value..."),
input.WithGroupInputName("search"),
)
func InputGroupText ¶
InputGroupText creates a text element for use inside addons.
Example:
input.InputGroupAddon(
[]input.AddonOption{input.WithAddonAlign(input.AlignInlineStart)},
input.InputGroupText("https://"),
)
func InputGroupTextarea ¶
func InputGroupTextarea(opts ...GroupTextareaOption) g.Node
InputGroupTextarea creates a textarea styled for use inside input groups.
This textarea removes its own border and shadow since the parent InputGroup handles those. Note: You can also use the regular Textarea component inside InputGroup - it will be styled automatically.
Example:
input.InputGroupTextarea(
input.WithGroupTextareaPlaceholder("Enter message..."),
input.WithGroupTextareaRows(4),
)
func InputLeftAddon
deprecated
func InputLeftAddon(opts []AddonOption, children ...g.Node) g.Node
InputLeftAddon creates a left addon (prefix) attached to the input.
Deprecated: Use InputGroupAddon with WithAddonAlign(AlignInlineStart) instead.
func InputLeftElement
deprecated
func InputLeftElement(opts []ElementOption, children ...g.Node) g.Node
InputLeftElement creates a left element positioned absolutely inside the input.
Deprecated: Use InputGroupAddon with WithAddonAlign(AlignInlineStart) instead.
func InputRightAddon
deprecated
func InputRightAddon(opts []AddonOption, children ...g.Node) g.Node
InputRightAddon creates a right addon (suffix) attached to the input.
Deprecated: Use InputGroupAddon with WithAddonAlign(AlignInlineEnd) instead.
func InputRightElement
deprecated
func InputRightElement(opts []ElementOption, children ...g.Node) g.Node
InputRightElement creates a right element positioned absolutely inside the input.
Deprecated: Use InputGroupAddon with WithAddonAlign(AlignInlineEnd) instead.
func SearchInput ¶
SearchInput creates a search input with a search icon
func WithTextClass ¶
func WithTextClass(class string) func(*textProps)
WithTextClass adds custom classes to the text element
Types ¶
type AddonOption ¶
type AddonOption func(*AddonProps)
AddonOption is a functional option for configuring addons
func WithAddonAlign ¶
func WithAddonAlign(align Alignment) AddonOption
WithAddonAlign sets the alignment of the addon
func WithAddonAttrs ¶
func WithAddonAttrs(attrs ...g.Node) AddonOption
WithAddonAttrs adds custom attributes to the addon
func WithAddonClass ¶
func WithAddonClass(class string) AddonOption
WithAddonClass adds custom classes to the addon
type AddonProps ¶
AddonProps defines addon configuration
type ElementOption ¶
type ElementOption func(*ElementProps)
ElementOption is a functional option for configuring positioned elements
func WithElementAttrs ¶
func WithElementAttrs(attrs ...g.Node) ElementOption
WithElementAttrs adds custom attributes to the element
func WithElementClass ¶
func WithElementClass(class string) ElementOption
WithElementClass adds custom classes to the element
type ElementProps ¶
ElementProps defines positioned element configuration
type GroupButtonOption ¶
type GroupButtonOption func(*GroupButtonProps)
GroupButtonOption is a functional option for configuring group buttons
func WithGroupButtonAttrs ¶
func WithGroupButtonAttrs(attrs ...g.Node) GroupButtonOption
WithGroupButtonAttrs adds custom attributes to the button
func WithGroupButtonClass ¶
func WithGroupButtonClass(class string) GroupButtonOption
WithGroupButtonClass adds custom classes to the button
func WithGroupButtonSize ¶
func WithGroupButtonSize(size GroupButtonSize) GroupButtonOption
WithGroupButtonSize sets the button size
func WithGroupButtonType ¶
func WithGroupButtonType(t string) GroupButtonOption
WithGroupButtonType sets the button type
func WithGroupButtonVariant ¶
func WithGroupButtonVariant(v forgeui.Variant) GroupButtonOption
WithGroupButtonVariant sets the button variant
type GroupButtonProps ¶
type GroupButtonProps struct {
Size GroupButtonSize
Variant forgeui.Variant
Type string
Class string
Attrs []g.Node
}
GroupButtonProps defines input group button configuration
type GroupButtonSize ¶
type GroupButtonSize string
GroupButtonSize defines the size of buttons in input groups
const ( GroupButtonSizeXS GroupButtonSize = "xs" GroupButtonSizeSM GroupButtonSize = "sm" GroupButtonSizeIconXS GroupButtonSize = "icon-xs" GroupButtonSizeIconSM GroupButtonSize = "icon-sm" )
type GroupInputOption ¶
type GroupInputOption func(*GroupInputProps)
GroupInputOption is a functional option for configuring group inputs
func GroupInputDisabled ¶
func GroupInputDisabled() GroupInputOption
GroupInputDisabled sets the disabled attribute
func GroupInputInvalid ¶
func GroupInputInvalid() GroupInputOption
GroupInputInvalid sets the aria-invalid attribute for error states
func GroupInputRequired ¶
func GroupInputRequired() GroupInputOption
GroupInputRequired sets the required attribute
func WithGroupInputAttrs ¶
func WithGroupInputAttrs(attrs ...g.Node) GroupInputOption
WithGroupInputAttrs adds custom attributes to the input
func WithGroupInputClass ¶
func WithGroupInputClass(class string) GroupInputOption
WithGroupInputClass adds custom classes to the input
func WithGroupInputID ¶
func WithGroupInputID(id string) GroupInputOption
WithGroupInputID sets the input ID
func WithGroupInputName ¶
func WithGroupInputName(name string) GroupInputOption
WithGroupInputName sets the input name
func WithGroupInputPlaceholder ¶
func WithGroupInputPlaceholder(placeholder string) GroupInputOption
WithGroupInputPlaceholder sets the input placeholder
func WithGroupInputType ¶
func WithGroupInputType(t string) GroupInputOption
WithGroupInputType sets the input type
func WithGroupInputValue ¶
func WithGroupInputValue(value string) GroupInputOption
WithGroupInputValue sets the input value
type GroupInputProps ¶
type GroupInputProps struct {
Type string
Name string
ID string
Placeholder string
Value string
Required bool
Disabled bool
Invalid bool
Class string
Attrs []g.Node
}
GroupInputProps defines input group input configuration
type GroupOption ¶
type GroupOption func(*GroupProps)
GroupOption is a functional option for configuring input groups
func GroupDisabled ¶
func GroupDisabled() GroupOption
GroupDisabled sets the disabled state on the input group
func WithGroupAttrs ¶
func WithGroupAttrs(attrs ...g.Node) GroupOption
WithGroupAttrs adds custom attributes to the input group
func WithGroupClass ¶
func WithGroupClass(class string) GroupOption
WithGroupClass adds custom classes to the input group
type GroupProps ¶
GroupProps defines input group configuration
type GroupTextareaOption ¶
type GroupTextareaOption func(*GroupTextareaProps)
GroupTextareaOption is a functional option for configuring group textareas
func GroupTextareaDisabled ¶
func GroupTextareaDisabled() GroupTextareaOption
GroupTextareaDisabled sets the disabled attribute
func GroupTextareaInvalid ¶
func GroupTextareaInvalid() GroupTextareaOption
GroupTextareaInvalid sets the aria-invalid attribute for error states
func GroupTextareaRequired ¶
func GroupTextareaRequired() GroupTextareaOption
GroupTextareaRequired sets the required attribute
func WithGroupTextareaAttrs ¶
func WithGroupTextareaAttrs(attrs ...g.Node) GroupTextareaOption
WithGroupTextareaAttrs adds custom attributes to the textarea
func WithGroupTextareaClass ¶
func WithGroupTextareaClass(class string) GroupTextareaOption
WithGroupTextareaClass adds custom classes to the textarea
func WithGroupTextareaID ¶
func WithGroupTextareaID(id string) GroupTextareaOption
WithGroupTextareaID sets the textarea ID
func WithGroupTextareaName ¶
func WithGroupTextareaName(name string) GroupTextareaOption
WithGroupTextareaName sets the textarea name
func WithGroupTextareaPlaceholder ¶
func WithGroupTextareaPlaceholder(placeholder string) GroupTextareaOption
WithGroupTextareaPlaceholder sets the textarea placeholder
func WithGroupTextareaRows ¶
func WithGroupTextareaRows(rows int) GroupTextareaOption
WithGroupTextareaRows sets the textarea rows
func WithGroupTextareaValue ¶
func WithGroupTextareaValue(value string) GroupTextareaOption
WithGroupTextareaValue sets the textarea value
type GroupTextareaProps ¶
type GroupTextareaProps struct {
Name string
ID string
Placeholder string
Value string
Rows int
Required bool
Disabled bool
Invalid bool
Class string
Attrs []g.Node
}
GroupTextareaProps defines input group textarea configuration