textarea

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package textarea implements textarea fields.

templ: version: v0.2.793

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func C

func C(def D) templ.Component
Example
package main

import (
	"context"
	"os"

	"github.com/jfbus/templui/components/icon"
	"github.com/jfbus/templui/components/size"
	"github.com/jfbus/templui/components/textarea"
)

func main() {
	c := textarea.C(textarea.D{
		Name:  "comment",
		Label: "Commentaire",
		Value: "Previous comment",
		Rows:  3,
		Size:  size.S,
		Icon:  icon.Text,
	})
	_ = c.Render(context.TODO(), os.Stdout)
}
Output:

Types

type D

type D struct {
	ID string
	// Name is the input name.
	Name  string
	Style style.Style
	// Type is the input type (text, password, ...).
	Label any
	// Value is the input value.
	Value string
	// Placeholder is the placeholder text displayed when no value is set.
	Placeholder string
	// Rows defines the number of rows
	Rows int
	// Disabled disables the input.
	Disabled bool
	// Size defines the input size (size.S, size.Normal (default) or size.L).
	Size size.Size
	// Loader displays a spinning loader when an HTMX action is triggered by the input.
	Loader bool
	// Icon displays an icon on the left side.
	Icon string
	// IconPosition can be position.Start (default) or position.End.
	IconPosition position.Position
	// Message adds a validation message below the field.
	// Just add &message.D{} to add automatic validation.
	//playground:import:github.com/jfbus/templui/components/form/validation/message
	//playground:default:&message.D{Message: "Validation message"}
	Message *message.D
	// CustomStyle defines a custom style.
	// 	style.Custom{
	// 		"textarea":       style.D{style.Add("...")},
	// 		"textarea/input": style.D{style.Add("...")},
	// 		"textarea/icon":  style.D{style.Add("...")},
	// 		"textarea/label":  style.D{style.Add("...")},
	//	}
	CustomStyle style.Custom
	Attributes  templ.Attributes
}

D is the definition for textarea fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL