starter

package
v0.1.41 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package starter provides a library of reusable UI components for GoSPA applications

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlertIconClasses

func AlertIconClasses(variant AlertVariant) string

AlertIconClasses returns icon color classes for alert variant

func AlertVariantClasses

func AlertVariantClasses(variant AlertVariant) string

AlertVariantClasses returns CSS classes for alert variant

func BadgeSizeClasses

func BadgeSizeClasses(size BadgeSize) string

BadgeSizeClasses returns CSS classes for badge size

func BadgeVariantClasses

func BadgeVariantClasses(variant BadgeVariant) string

BadgeVariantClasses returns CSS classes for badge variant

func Button added in v0.1.32

func Button(props ButtonProps) templ.Component

Button renders a button component

func ButtonClasses

func ButtonClasses(props ButtonProps) string

ButtonClasses returns the CSS classes for a button based on props

func CardBodyClasses

func CardBodyClasses(props CardBodyProps) string

CardBodyClasses returns CSS classes for card body

func CardClasses

func CardClasses(props CardProps) string

CardClasses returns CSS classes for a card

func CardFooterClasses

func CardFooterClasses(props CardFooterProps) string

CardFooterClasses returns CSS classes for card footer

func CardHeaderClasses

func CardHeaderClasses(props CardHeaderProps) string

CardHeaderClasses returns CSS classes for card header

func DangerButton added in v0.1.32

func DangerButton(props ButtonProps) templ.Component

DangerButton renders a danger button

func DateInput added in v0.1.32

func DateInput(props InputProps) templ.Component

DateInput is a convenience component for date inputs

func EmailInput added in v0.1.32

func EmailInput(props InputProps) templ.Component

EmailInput is a convenience component for email inputs

func GhostButton added in v0.1.32

func GhostButton(props ButtonProps) templ.Component

GhostButton renders a ghost button

func HelperTextClasses

func HelperTextClasses(props InputProps) string

HelperTextClasses returns CSS classes for helper text

func IconButton added in v0.1.32

func IconButton(props ButtonProps) templ.Component

IconButton renders a button with only an icon

func Input added in v0.1.32

func Input(props InputProps) templ.Component

Input renders a text input with label and helper text

func InputClasses

func InputClasses(props InputProps) string

InputClasses returns the CSS classes for an input based on props

func LabelClasses

func LabelClasses(props InputProps) string

LabelClasses returns CSS classes for input labels

func ModalBodyClasses

func ModalBodyClasses(props ModalBodyProps) string

ModalBodyClasses returns CSS classes for modal body

func ModalFooterClasses

func ModalFooterClasses(props ModalFooterProps) string

ModalFooterClasses returns CSS classes for modal footer

func ModalHeaderClasses

func ModalHeaderClasses(props ModalHeaderProps) string

ModalHeaderClasses returns CSS classes for modal header

func ModalSizeClasses

func ModalSizeClasses(size ModalSize) string

ModalSizeClasses returns CSS classes for modal size

func NumberInput added in v0.1.32

func NumberInput(props InputProps) templ.Component

NumberInput is a convenience component for number inputs

func OutlineButton added in v0.1.32

func OutlineButton(props ButtonProps) templ.Component

OutlineButton renders an outline button

func PasswordInput added in v0.1.32

func PasswordInput(props InputProps) templ.Component

PasswordInput is a convenience component for password inputs

func PrimaryButton added in v0.1.32

func PrimaryButton(props ButtonProps) templ.Component

PrimaryButton renders a primary button

func SearchInput added in v0.1.32

func SearchInput(props InputProps) templ.Component

SearchInput is a convenience component for search inputs

func SecondaryButton added in v0.1.32

func SecondaryButton(props ButtonProps) templ.Component

SecondaryButton renders a secondary button

func SkeletonVariantClasses

func SkeletonVariantClasses(variant SkeletonVariant) string

SkeletonVariantClasses returns CSS classes for skeleton variant

func TextArea added in v0.1.32

func TextArea(props InputProps) templ.Component

TextArea renders a multi-line text input

Types

type AlertProps

type AlertProps struct {
	// ID is the unique identifier
	ID string
	// Title is the alert title
	Title string
	// Message is the alert message
	Message string
	// Variant controls the alert style
	Variant AlertVariant
	// Dismissible allows the alert to be closed
	Dismissible bool
	// Class is additional CSS classes
	Class string
}

AlertProps defines the properties for an alert component

func DefaultAlertProps

func DefaultAlertProps() AlertProps

DefaultAlertProps returns alert props with default values

type AlertVariant

type AlertVariant string

AlertVariant defines the style variant for an alert

const (
	// AlertVariantInfo is an info alert
	AlertVariantInfo AlertVariant = "info"
	// AlertVariantSuccess is a success alert
	AlertVariantSuccess AlertVariant = "success"
	// AlertVariantWarning is a warning alert
	AlertVariantWarning AlertVariant = "warning"
	// AlertVariantError is an error alert
	AlertVariantError AlertVariant = "error"
)

type BadgeProps

type BadgeProps struct {
	// ID is the unique identifier
	ID string
	// Text is the badge text
	Text string
	// Variant controls the badge style
	Variant BadgeVariant
	// Size controls the badge size
	Size BadgeSize
	// Class is additional CSS classes
	Class string
}

BadgeProps defines the properties for a badge component

func DefaultBadgeProps

func DefaultBadgeProps() BadgeProps

DefaultBadgeProps returns badge props with default values

type BadgeSize

type BadgeSize string

BadgeSize defines the size of a badge

const (
	// BadgeSizeSmall is a small badge
	BadgeSizeSmall BadgeSize = "small"
	// BadgeSizeMedium is a medium badge
	BadgeSizeMedium BadgeSize = "medium"
	// BadgeSizeLarge is a large badge
	BadgeSizeLarge BadgeSize = "large"
)

type BadgeVariant

type BadgeVariant string

BadgeVariant defines the style variant for a badge

const (
	// BadgeVariantDefault is a default badge
	BadgeVariantDefault BadgeVariant = "default"
	// BadgeVariantPrimary is a primary badge
	BadgeVariantPrimary BadgeVariant = "primary"
	// BadgeVariantSuccess is a success badge
	BadgeVariantSuccess BadgeVariant = "success"
	// BadgeVariantWarning is a warning badge
	BadgeVariantWarning BadgeVariant = "warning"
	// BadgeVariantError is an error badge
	BadgeVariantError BadgeVariant = "error"
)

type ButtonProps

type ButtonProps struct {
	// Variant defines the visual style (primary, secondary, outline, ghost, danger)
	Variant ButtonVariant
	// Size defines the button size (xs, sm, md, lg, xl)
	Size ButtonSize
	// Disabled disables the button
	Disabled bool
	// Loading shows a loading spinner
	Loading bool
	// FullWidth makes the button full width
	FullWidth bool
	// Type is the button type (button, submit, reset)
	Type string
	// Href converts the button to a link
	Href string
	// Target for links (_blank, etc.)
	Target string
	// ID is the element ID
	ID string
	// Class adds additional CSS classes
	Class string
	// Attributes adds additional HTML attributes
	Attributes templ.Attributes
	// Onclick is the click handler
	Onclick string
}

ButtonProps defines the properties for a Button component

func DefaultButtonProps

func DefaultButtonProps() ButtonProps

DefaultButtonProps returns ButtonProps with default values

func MergeButtonProps

func MergeButtonProps(props ButtonProps) ButtonProps

MergeButtonProps merges provided props with defaults

type ButtonSize

type ButtonSize string

ButtonSize defines the size of a button

const (
	// ButtonSizeXS is an extra small button
	ButtonSizeXS ButtonSize = "xs"
	// ButtonSizeSM is a small button
	ButtonSizeSM ButtonSize = "sm"
	// ButtonSizeMD is a medium button
	ButtonSizeMD ButtonSize = "md"
	// ButtonSizeLG is a large button
	ButtonSizeLG ButtonSize = "lg"
	// ButtonSizeXL is an extra large button
	ButtonSizeXL ButtonSize = "xl"
)

type ButtonVariant

type ButtonVariant string

ButtonVariant defines the visual style of a button

const (
	// ButtonPrimary is a primary button
	ButtonPrimary ButtonVariant = "primary"
	// ButtonSecondary is a secondary button
	ButtonSecondary ButtonVariant = "secondary"
	// ButtonOutline is an outline button
	ButtonOutline ButtonVariant = "outline"
	// ButtonGhost is a ghost button
	ButtonGhost ButtonVariant = "ghost"
	// ButtonDanger is a danger button
	ButtonDanger ButtonVariant = "danger"
)

type CardBodyProps

type CardBodyProps struct {
	// Class is additional CSS classes
	Class string
}

CardBodyProps defines properties for a card body

type CardFooterProps

type CardFooterProps struct {
	// Class is additional CSS classes
	Class string
}

CardFooterProps defines properties for a card footer

type CardHeaderProps

type CardHeaderProps struct {
	// Class is additional CSS classes
	Class string
}

CardHeaderProps defines properties for a card header

type CardProps

type CardProps struct {
	// ID is the unique identifier
	ID string
	// Title is the card title
	Title string
	// Subtitle is the card subtitle
	Subtitle string
	// Class is additional CSS classes
	Class string
	// Padding controls the card padding
	Padding bool
	// Shadow controls the card shadow
	Shadow bool
	// Border controls the card border
	Border bool
	// Rounded controls the border radius
	Rounded bool
	// Hover enables hover effects
	Hover bool
	// Attributes are additional HTML attributes
	Attributes templ.Attributes
}

CardProps defines the properties for a card component

func DefaultCardProps

func DefaultCardProps() CardProps

DefaultCardProps returns card props with default values

func MergeCardProps

func MergeCardProps(props CardProps) CardProps

MergeCardProps merges provided props with defaults. Zero-value booleans are replaced with the default values from DefaultCardProps.

type InputProps

type InputProps struct {
	// ID is the unique identifier for the input
	ID string
	// Name is the name attribute for form submission
	Name string
	// Type is the input type (text, email, password, etc.)
	Type InputType
	// Placeholder is the placeholder text
	Placeholder string
	// Value is the current value
	Value string
	// DefaultValue is the default value for uncontrolled inputs
	DefaultValue string
	// Size is the input size
	Size InputSize
	// Disabled indicates if the input is disabled
	Disabled bool
	// ReadOnly indicates if the input is read-only
	ReadOnly bool
	// Required indicates if the input is required
	Required bool
	// AutoFocus indicates if the input should auto-focus
	AutoFocus bool
	// Error indicates if the input has an error state
	Error bool
	// ErrorMessage is the error message to display
	ErrorMessage string
	// Label is the label text for the input
	Label string
	// HelperText is additional helper text below the input
	HelperText string
	// Class is additional CSS classes
	Class string
	// Attributes are additional HTML attributes
	Attributes templ.Attributes
	// Min is the minimum value (for number/date inputs)
	Min string
	// Max is the maximum value (for number/date inputs)
	Max string
	// Step is the step value (for number inputs)
	Step string
	// Pattern is the regex pattern for validation
	Pattern string
	// MaxLength is the maximum character length
	MaxLength int
	// MinLength is the minimum character length
	MinLength int
	// AutoComplete is the autocomplete attribute
	AutoComplete string
}

InputProps defines the properties for an input component

func DefaultInputProps

func DefaultInputProps() InputProps

DefaultInputProps returns input props with default values

func MergeInputProps

func MergeInputProps(props InputProps) InputProps

MergeInputProps merges provided props with defaults

type InputSize

type InputSize string

InputSize defines the size of the input

const (
	// InputSmall is a small input
	InputSmall InputSize = "small"
	// InputMedium is a medium input
	InputMedium InputSize = "medium"
	// InputLarge is a large input
	InputLarge InputSize = "large"
)

type InputType

type InputType string

InputType defines the type of input field

const (
	// InputText is a text field
	InputText InputType = "text"
	// InputEmail is an email field
	InputEmail InputType = "email"
	// InputPassword is a password field
	InputPassword InputType = "password"
	// InputNumber is a number field
	InputNumber InputType = "number"
	// InputTel is a telephone field
	InputTel InputType = "tel"
	// InputURL is a URL field
	InputURL InputType = "url"
	// InputSearch is a search field
	InputSearch InputType = "search"
	// InputDate is a date field
	InputDate InputType = "date"
	// InputTime is a time field
	InputTime InputType = "time"
	// InputDateTime is a datetime-local field
	InputDateTime InputType = "datetime-local"
)

type ModalBodyProps

type ModalBodyProps struct {
	// Class is additional CSS classes
	Class string
}

ModalBodyProps defines properties for a modal body

type ModalFooterProps

type ModalFooterProps struct {
	// Class is additional CSS classes
	Class string
}

ModalFooterProps defines properties for a modal footer

type ModalHeaderProps

type ModalHeaderProps struct {
	// Class is additional CSS classes
	Class string
}

ModalHeaderProps defines properties for a modal header

type ModalProps

type ModalProps struct {
	// ID is the unique identifier
	ID string
	// Title is the modal title
	Title string
	// Size controls the modal size
	Size ModalSize
	// Open controls whether the modal is visible
	Open bool
	// CloseOnOverlay enables closing when clicking outside
	CloseOnOverlay bool
	// CloseOnEscape enables closing with Escape key
	CloseOnEscape bool
	// ShowCloseButton shows the close button
	ShowCloseButton bool
	// Class is additional CSS classes
	Class string
}

ModalProps defines the properties for a modal component

func DefaultModalProps

func DefaultModalProps() ModalProps

DefaultModalProps returns modal props with default values

type ModalSize

type ModalSize string

ModalSize defines the size of a modal

const (
	// ModalSizeSmall is a small modal
	ModalSizeSmall ModalSize = "small"
	// ModalSizeMedium is a medium modal
	ModalSizeMedium ModalSize = "medium"
	// ModalSizeLarge is a large modal
	ModalSizeLarge ModalSize = "large"
	// ModalSizeFull is a full modal
	ModalSizeFull ModalSize = "full"
)

type SkeletonCardProps

type SkeletonCardProps struct {
	// ID is the unique identifier
	ID string
	// ShowImage controls whether to show image placeholder
	ShowImage bool
	// ImageHeight is the height of the image placeholder
	ImageHeight string
	// ShowAvatar controls whether to show avatar placeholder
	ShowAvatar bool
	// ShowTitle controls whether to show title placeholder
	ShowTitle bool
	// ShowDescription controls whether to show description placeholder
	ShowDescription bool
	// DescriptionLines is the number of description lines
	DescriptionLines int
	// Class is additional CSS classes
	Class string
}

SkeletonCardProps defines properties for a skeleton card

func DefaultSkeletonCardProps

func DefaultSkeletonCardProps() SkeletonCardProps

DefaultSkeletonCardProps returns skeleton card props with defaults

type SkeletonProps

type SkeletonProps struct {
	// ID is the unique identifier
	ID string
	// Width is the skeleton width (CSS value)
	Width string
	// Height is the skeleton height (CSS value)
	Height string
	// Variant controls the skeleton shape
	Variant SkeletonVariant
	// Class is additional CSS classes
	Class string
	// Animated controls whether the skeleton has pulse animation
	Animated bool
}

SkeletonProps defines the properties for a skeleton loading component

func DefaultSkeletonProps

func DefaultSkeletonProps() SkeletonProps

DefaultSkeletonProps returns skeleton props with default values

type SkeletonTableProps

type SkeletonTableProps struct {
	// ID is the unique identifier
	ID string
	// Rows is the number of rows
	Rows int
	// Columns is the number of columns
	Columns int
	// ShowHeader controls whether to show header row
	ShowHeader bool
	// Class is additional CSS classes
	Class string
}

SkeletonTableProps defines properties for a skeleton table

func DefaultSkeletonTableProps

func DefaultSkeletonTableProps() SkeletonTableProps

DefaultSkeletonTableProps returns skeleton table props with defaults

type SkeletonTextProps

type SkeletonTextProps struct {
	// ID is the unique identifier
	ID string
	// Lines is the number of text lines
	Lines int
	// LineHeight is the height of each line
	LineHeight string
	// LastLineWidth is the width of the last line (percentage or CSS value)
	LastLineWidth string
	// Class is additional CSS classes
	Class string
}

SkeletonTextProps defines properties for skeleton text

func DefaultSkeletonTextProps

func DefaultSkeletonTextProps() SkeletonTextProps

DefaultSkeletonTextProps returns skeleton text props with defaults

type SkeletonVariant

type SkeletonVariant string

SkeletonVariant defines the shape variant for skeleton

const (
	// SkeletonVariantText is a text skeleton
	SkeletonVariantText SkeletonVariant = "text"
	// SkeletonVariantCircle is a circle skeleton
	SkeletonVariantCircle SkeletonVariant = "circle"
	// SkeletonVariantRect is a rectangle skeleton
	SkeletonVariantRect SkeletonVariant = "rect"
	// SkeletonVariantRounded is a rounded skeleton
	SkeletonVariantRounded SkeletonVariant = "rounded"
)

Jump to

Keyboard shortcuts

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