starter

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 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 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 HelperTextClasses

func HelperTextClasses(props InputProps) string

HelperTextClasses returns CSS classes for 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 SkeletonVariantClasses

func SkeletonVariantClasses(variant SkeletonVariant) string

SkeletonVariantClasses returns CSS classes for skeleton variant

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    AlertVariant = "info"
	AlertVariantSuccess AlertVariant = "success"
	AlertVariantWarning AlertVariant = "warning"
	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  BadgeSize = "small"
	BadgeSizeMedium BadgeSize = "medium"
	BadgeSizeLarge  BadgeSize = "large"
)

type BadgeVariant

type BadgeVariant string

BadgeVariant defines the style variant for a badge

const (
	BadgeVariantDefault BadgeVariant = "default"
	BadgeVariantPrimary BadgeVariant = "primary"
	BadgeVariantSuccess BadgeVariant = "success"
	BadgeVariantWarning BadgeVariant = "warning"
	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 ButtonSize = "xs"
	ButtonSizeSM ButtonSize = "sm"
	ButtonSizeMD ButtonSize = "md"
	ButtonSizeLG ButtonSize = "lg"
	ButtonSizeXL ButtonSize = "xl"
)

type ButtonVariant

type ButtonVariant string

ButtonVariant defines the visual style of a button

const (
	ButtonPrimary   ButtonVariant = "primary"
	ButtonSecondary ButtonVariant = "secondary"
	ButtonOutline   ButtonVariant = "outline"
	ButtonGhost     ButtonVariant = "ghost"
	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 map[string]string
}

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 For booleans, zero value (false) is treated as "use default"

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 map[string]string
	// 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  InputSize = "small"
	InputMedium InputSize = "medium"
	InputLarge  InputSize = "large"
)

type InputType

type InputType string

InputType defines the type of input field

const (
	InputText     InputType = "text"
	InputEmail    InputType = "email"
	InputPassword InputType = "password"
	InputNumber   InputType = "number"
	InputTel      InputType = "tel"
	InputURL      InputType = "url"
	InputSearch   InputType = "search"
	InputDate     InputType = "date"
	InputTime     InputType = "time"
	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  ModalSize = "small"
	ModalSizeMedium ModalSize = "medium"
	ModalSizeLarge  ModalSize = "large"
	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    SkeletonVariant = "text"
	SkeletonVariantCircle  SkeletonVariant = "circle"
	SkeletonVariantRect    SkeletonVariant = "rect"
	SkeletonVariantRounded SkeletonVariant = "rounded"
)

Jump to

Keyboard shortcuts

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