Documentation
¶
Overview ¶
Package starter provides a library of reusable UI components for GoSPA applications
Index ¶
- func AlertIconClasses(variant AlertVariant) string
- func AlertVariantClasses(variant AlertVariant) string
- func BadgeSizeClasses(size BadgeSize) string
- func BadgeVariantClasses(variant BadgeVariant) string
- func Button(props ButtonProps) templ.Component
- func ButtonClasses(props ButtonProps) string
- func CardBodyClasses(props CardBodyProps) string
- func CardClasses(props CardProps) string
- func CardFooterClasses(props CardFooterProps) string
- func CardHeaderClasses(props CardHeaderProps) string
- func DangerButton(props ButtonProps) templ.Component
- func DateInput(props InputProps) templ.Component
- func EmailInput(props InputProps) templ.Component
- func GhostButton(props ButtonProps) templ.Component
- func HelperTextClasses(props InputProps) string
- func IconButton(props ButtonProps) templ.Component
- func Input(props InputProps) templ.Component
- func InputClasses(props InputProps) string
- func LabelClasses(props InputProps) string
- func ModalBodyClasses(props ModalBodyProps) string
- func ModalFooterClasses(props ModalFooterProps) string
- func ModalHeaderClasses(props ModalHeaderProps) string
- func ModalSizeClasses(size ModalSize) string
- func NumberInput(props InputProps) templ.Component
- func OutlineButton(props ButtonProps) templ.Component
- func PasswordInput(props InputProps) templ.Component
- func PrimaryButton(props ButtonProps) templ.Component
- func SearchInput(props InputProps) templ.Component
- func SecondaryButton(props ButtonProps) templ.Component
- func SkeletonVariantClasses(variant SkeletonVariant) string
- func TextArea(props InputProps) templ.Component
- type AlertProps
- type AlertVariant
- type BadgeProps
- type BadgeSize
- type BadgeVariant
- type ButtonProps
- type ButtonSize
- type ButtonVariant
- type CardBodyProps
- type CardFooterProps
- type CardHeaderProps
- type CardProps
- type InputProps
- type InputSize
- type InputType
- type ModalBodyProps
- type ModalFooterProps
- type ModalHeaderProps
- type ModalProps
- type ModalSize
- type SkeletonCardProps
- type SkeletonProps
- type SkeletonTableProps
- type SkeletonTextProps
- type SkeletonVariant
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 ¶
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 ¶
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 ¶
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 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 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 ¶
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 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 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 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" )