form

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: GPL-3.0 Imports: 9 Imported by: 1

README

ez-form

Form library for dragonfly server

Add to your project

go get -u github.com/akmalfairuz/ez-form@master

Example

See example/main.go folder

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button interface {
	WithImage(image string) Button
	MarshalJSON() ([]byte, error)
}

func NewButton

func NewButton(text string) Button

type Custom

type Custom interface {
	form.Form

	WithElement(key string, element Element) Custom
	WithCallback(callback func(p *player.Player, response CustomResponse)) Custom
	WithCloseCallback(callback func(p *player.Player)) Custom
}

func NewCustom

func NewCustom(title string) Custom

type CustomResponse

type CustomResponse interface {
	String(key string) string
	Int(key string) int
	Float(key string) float64
	Bool(key string) bool
	Bind(v any) error
}
type Dropdown interface {
	Element

	WithOptions(options ...string) Dropdown
	WithDefaultIndex(index int) Dropdown
}

func NewDropdown

func NewDropdown(text string) Dropdown

func NewStepSlider

func NewStepSlider(text string) Dropdown

type Element

type Element interface {
	json.Marshaler
	// contains filtered or unexported methods
}

func NewLabel

func NewLabel(text string) Element

func NewToggle

func NewToggle(text string, enabled bool) Element

type Input

type Input interface {
	Element

	WithPlaceholder(placeholder string) Input
	WithDefault(value string) Input
}

func NewInput

func NewInput(text string) Input
type Menu interface {
	form.Form

	WithButton(text string, image ...string) Menu
	WithContent(content string) Menu
	WithCallback(callback func(p *player.Player, result int)) Menu
	WithCloseCallback(callback func(p *player.Player)) Menu
}

func NewMenu

func NewMenu(title string) Menu
type Modal interface {
	form.Form

	WithContent(content string) Modal
	WithButton1(text string) Modal
	WithButton2(text string) Modal
	WithCallback(callback func(p *player.Player, button1 bool)) Modal
	WithCloseCallback(callback func(p *player.Player)) Modal
}

func NewModal

func NewModal(title string) Modal

type Slider

type Slider interface {
	Element

	WithStepSize(stepSize float64) Slider
	WithDefault(value float64) Slider
}

func NewSlider

func NewSlider(text string, min, max float64) Slider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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