component

package
v0.0.0-...-d761283 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SizeSm = size{"sm"}
	SizeMd = size{"md"}
	SizeLg = size{"lg"}

	ColorPrimary   = color{"primary"}
	ColorSecondary = color{"secondary"}
	ColorAccent    = color{"accent"}
	ColorNeutral   = color{"neutral"}
	ColorInfo      = color{"info"}
	ColorSuccess   = color{"success"}
	ColorWarning   = color{"warning"}
	ColorError     = color{"error"}

	DropdownPositionTop    = dropdownPosition{"top"}
	DropdownPositionBottom = dropdownPosition{"bottom"}
	DropdownPositionLeft   = dropdownPosition{"left"}
	DropdownPositionRight  = dropdownPosition{"right"}

	InputTypeText     = inputType{"text"}
	InputTypePassword = inputType{"password"}
	InputTypeEmail    = inputType{"email"}
	InputTypeNumber   = inputType{"number"}
	InputTypeTel      = inputType{"tel"}
	InputTypeUrl      = inputType{"url"}
)

Functions

func BText

func BText(text string) gomponents.Node

BText is a convenience function to create a B element with a simple text node as its child.

func CardBox

func CardBox(params CardBoxParams) gomponents.Node

CardBox renders a card box with the given children.

func CardBoxSimple

func CardBoxSimple(children ...gomponents.Node) gomponents.Node

CardBoxSimple is the same as CardBox, but with a less verbose api and default props. It renders a card box with the given children.

func ChangeThemeButton

func ChangeThemeButton(params ChangeThemeButtonParams) gomponents.Node

func CopyButtonLg

func CopyButtonLg(textToCopy string) gomponents.Node

CopyButtonLg is a large copy button.

func CopyButtonMd

func CopyButtonMd(textToCopy string) gomponents.Node

CopyButtonMd is a medium copy button.

func CopyButtonSm

func CopyButtonSm(textToCopy string) gomponents.Node

CopyButtonSm is a small copy button.

func EmptyResults

func EmptyResults(params EmptyResultsParams) gomponents.Node

func EmptyResultsTr

func EmptyResultsTr(params EmptyResultsParams) gomponents.Node

func GMap

func GMap[T any](ts []T, cb func(T) gomponents.Node) gomponents.Node

GMap is a convenience function to render a gomponents.Group with a map inside.

func H1

func H1(children ...gomponents.Node) gomponents.Node

func H1Text

func H1Text(text string) gomponents.Node

H1Text is a convenience function to create an H1 element with a simple text node as its child.

func H2

func H2(children ...gomponents.Node) gomponents.Node

func H2Text

func H2Text(text string) gomponents.Node

H2Text is a convenience function to create an H2 element with a simple text node as its child.

func H3

func H3(children ...gomponents.Node) gomponents.Node

func H3Text

func H3Text(text string) gomponents.Node

H3Text is a convenience function to create an H3 element with a simple text node as its child.

func H4

func H4(children ...gomponents.Node) gomponents.Node

func H4Text

func H4Text(text string) gomponents.Node

H4Text is a convenience function to create an H4 element with a simple text node as its child.

func H5

func H5(children ...gomponents.Node) gomponents.Node

func H5Text

func H5Text(text string) gomponents.Node

H5Text is a convenience function to create an H5 element with a simple text node as its child.

func H6

func H6(children ...gomponents.Node) gomponents.Node

func H6Text

func H6Text(text string) gomponents.Node

H6Text is a convenience function to create an H6 element with a simple text node as its child.

func HealthStatusPing

func HealthStatusPing(
	testOk sql.NullBool, testError sql.NullString, lastTestAt sql.NullTime,
) gomponents.Node

func HelpButtonModal

func HelpButtonModal(params HelpButtonModalParams) gomponents.Node

func HxLoadingLg

func HxLoadingLg(id ...string) gomponents.Node

HxLoadingLg returns a large loading indicator.

func HxLoadingMd

func HxLoadingMd(id ...string) gomponents.Node

HxLoadingMd returns a loading indicator.

func HxLoadingSm

func HxLoadingSm(id ...string) gomponents.Node

HxLoadingSm returns a small loading indicator.

func InputControl

func InputControl(params InputControlParams) gomponents.Node

func IsActivePing

func IsActivePing(isActive bool) gomponents.Node

func Logotype

func Logotype() gomponents.Node

func OptionsDropdown

func OptionsDropdown(children ...gomponents.Node) gomponents.Node

func OptionsDropdownA

func OptionsDropdownA(children ...gomponents.Node) gomponents.Node

func OptionsDropdownButton

func OptionsDropdownButton(children ...gomponents.Node) gomponents.Node

func PText

func PText(text string) gomponents.Node

PText is a convenience function to create a P element with a simple text node as its child.

func Ping

func Ping(color color) gomponents.Node

func PrettyDestinationName

func PrettyDestinationName(
	isLocal bool, destinationName sql.NullString,
) gomponents.Node

func PrettyFileSize

func PrettyFileSize(
	size sql.NullInt64,
) gomponents.Node

PrettyFileSize pretty prints a file size (in bytes) to a human-readable format. If the size is not valid, it returns an empty string.

e.g. 1024 -> 1 KB

func RenderableGroup

func RenderableGroup(children []gomponents.Node) gomponents.Node

RenderableGroup renders a group of nodes without a parent element.

This is because gomponents.Group() cannot be directly rendered and needs to be wrapped in a parent element.

func SelectControl

func SelectControl(params SelectControlParams) gomponents.Node

func SkeletonTr

func SkeletonTr(rows int) gomponents.Node

func SpanText

func SpanText(text string) gomponents.Node

SpanText is a convenience function to create a Span element with a simple text node as its child.

func SpinnerContainerLg

func SpinnerContainerLg(height ...string) gomponents.Node

func SpinnerContainerMd

func SpinnerContainerMd(height ...string) gomponents.Node

func SpinnerContainerSm

func SpinnerContainerSm(height ...string) gomponents.Node

func SpinnerLg

func SpinnerLg() gomponents.Node

func SpinnerMd

func SpinnerMd() gomponents.Node

func SpinnerSm

func SpinnerSm() gomponents.Node

func StarOnGithub

func StarOnGithub(size size) gomponents.Node

func StatusBadge

func StatusBadge(status string) gomponents.Node

func TextareaControl

func TextareaControl(params TextareaControlParams) gomponents.Node

Types

type CardBoxParams

type CardBoxParams struct {
	Class    string
	Children []gomponents.Node
}

type ChangeThemeButtonParams

type ChangeThemeButtonParams struct {
	Position    dropdownPosition
	AlignsToEnd bool
	Size        size
}

type EmptyResultsParams

type EmptyResultsParams struct {
	Title    string
	Subtitle string
}

type HelpButtonModalParams

type HelpButtonModalParams struct {
	ModalTitle string
	ModalSize  size
	Children   []gomponents.Node
}

type InputControlParams

type InputControlParams struct {
	ID                 string
	Name               string
	Label              string
	Placeholder        string
	Required           bool
	Type               inputType
	HelpText           string
	Color              color
	AutoComplete       string
	Pattern            string
	Children           []gomponents.Node
	HelpButtonChildren []gomponents.Node
}

type ModalParams

type ModalParams struct {
	// ID is the ID of the modal dialog. If empty, a random ID will be generated.
	ID string
	// Content is the content of the modal dialog.
	Content []gomponents.Node
	// Size is the size of the modal dialog.
	// Can be "sm", "md", and "lg".
	// The default is "md".
	Size size
	// Title is the title of the modal dialog.
	// If you need more than a string, use TitleNode instead.
	Title string
	// TitleNode is the title of the modal dialog.
	// If you need only a string, use Title instead.
	TitleNode gomponents.Node
	// HTMXIndicator is an optional ID of an HTMX indicator that
	// should be inserted in the modal header.
	HTMXIndicator string
}

ModalParams are the props for the Modal component.

type ModalResult

type ModalResult struct {
	// HTML is the modal dialog HTML.
	HTML gomponents.Node
	// OpenerAttr is the attribute to add to the element that opens the modal dialog.
	OpenerAttr gomponents.Node
}

ModalResult is the result of creating a modal dialog.

func Modal(params ModalParams) ModalResult

Modal renders a modal dialog.

type SelectControlParams

type SelectControlParams struct {
	ID                 string
	Name               string
	Label              string
	Placeholder        string
	Required           bool
	HelpText           string
	Color              color
	AutoComplete       string
	Children           []gomponents.Node
	HelpButtonChildren []gomponents.Node
}

type TextareaControlParams

type TextareaControlParams struct {
	ID                 string
	Name               string
	Label              string
	Placeholder        string
	Required           bool
	HelpText           string
	Color              color
	AutoComplete       string
	Pattern            string
	Children           []gomponents.Node
	HelpButtonChildren []gomponents.Node
}

Jump to

Keyboard shortcuts

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