Documentation
¶
Index ¶
- Constants
- Variables
- func CheckboxSelection(title string, options []CheckboxOption) ([]string, error)
- func Confirm(question string) (bool, error)
- func ListSelection(title string, items []list.Item) (list.Item, error)
- func NewCheckboxModel(title string, options []CheckboxOption) checkboxModel
- func NewListModel(title string, items []list.Item) listModel
- func Prompt(question string) (string, error)
- func RadioSelection(title string, options []RadioOption, defaultSelection int) (string, error)
- func ReadMultilineInput() (string, error)
- func RenderBadge(text string, style lipgloss.Style) string
- func RenderCheckbox(checked bool, label string, focused bool) string
- func RenderCheckboxLegacy(checked bool, label string) string
- func RenderHelp(keys ...string) string
- func RenderProgress(current, total int, label string) string
- func RenderRadio(selected bool, label string, focused bool) string
- func RenderStep(current, total int, label string) string
- type CheckboxOption
- type RadioOption
Constants ¶
const ( // Primary Colors ColorAccent = "#00D9FF" // Bright cyan for primary actions ColorPrimary = "#874BFD" // Purple for highlights ColorSecondary = "#FF6B6B" // Coral for emphasis // UI Colors ColorSuccess = "#10B981" // Green for success ColorWarning = "#F59E0B" // Amber for warnings ColorError = "#EF4444" // Red for errors ColorInfo = "#3B82F6" // Blue for information // Neutral Colors ColorText = "#E4E4E7" // Light gray for primary text ColorTextDim = "#71717A" // Dimmed text ColorBorder = "#3F3F46" // Border color ColorBg = "#18181B" // Background ColorBgSubtle = "#27272A" // Subtle background )
Color Palette - Using a modern, cohesive color scheme
const ( IconCheck = "✓" IconCross = "✗" IconInfo = "ℹ" IconWarning = "⚠" IconArrowRight = "→" IconArrowLeft = "←" IconBullet = "•" IconDot = "·" // Selection indicators RadioEmpty = "○" RadioFilled = "●" CheckboxEmpty = "☐" CheckboxFilled = "☑" CheckboxPartial = "☒" // Cursor indicators CursorArrow = "▶" CursorBlock = "█" CursorLine = "│" )
Icons and symbols used consistently across components
Variables ¶
var ( // Title Styles - For section headers TitleStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorAccent)). Bold(true). MarginBottom(1) // Subtitle style for secondary headers SubtitleStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorText)). Italic(true) // Step indicator style (e.g., "Step 1/2") StepStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorPrimary)). Background(lipgloss.Color(ColorBgSubtle)). Padding(0, 2). Bold(true). MarginBottom(1) // Focus indicator styles FocusedStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorAccent)). Bold(true) UnfocusedStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorTextDim)) // Selection styles - Consistent across all components SelectedStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorAccent)). Bold(true) UnselectedStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorText)) // Item container styles ItemStyle = lipgloss.NewStyle(). PaddingLeft(2) FocusedItemStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.NormalBorder()). BorderLeft(true). BorderForeground(lipgloss.Color(ColorAccent)). PaddingLeft(1) // Description styles DescriptionStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorTextDim)). Italic(true). PaddingLeft(4) // Status indicator styles SuccessStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorSuccess)). Bold(true) ErrorStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorError)). Bold(true) WarningStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorWarning)). Bold(true) InfoStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorInfo)) // Help text style HelpStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorTextDim)). MarginTop(1) // Disabled style DisabledStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#3F3F46")). Strikethrough(true) // Checkbox specific styles CheckedStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorSuccess)) UncheckedStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorTextDim)) // Radio button specific styles RadioSelectedStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorPrimary)) RadioUnselectedStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorTextDim)) // Box/Container styles BoxStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color(ColorBorder)). Padding(1, 2) // Progress indicator ProgressStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorPrimary)) // Prompt styles PromptStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorPrimary)). Bold(true) // Input field style InputStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color(ColorBorder)). Padding(0, 1) FocusedInputStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color(ColorAccent)). Padding(0, 1) // Badge styles for status tags BadgeStyle = lipgloss.NewStyle(). Background(lipgloss.Color(ColorBgSubtle)). Foreground(lipgloss.Color(ColorText)). Padding(0, 1). MarginLeft(1) BadgeSuccessStyle = lipgloss.NewStyle(). Background(lipgloss.Color(ColorSuccess)). Foreground(lipgloss.Color("#FFFFFF")). Padding(0, 1). MarginLeft(1) BadgeWarningStyle = lipgloss.NewStyle(). Background(lipgloss.Color(ColorWarning)). Foreground(lipgloss.Color("#000000")). Padding(0, 1). MarginLeft(1) // Cursor and selection indicators CursorStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorAccent)). Bold(true) // List item styles (redefining for consistency) ListItemStyle = lipgloss.NewStyle(). PaddingLeft(2) SelectedItemStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color(ColorAccent)). Bold(true). PaddingLeft(2) // Legacy style mappings for compatibility QuestionStyle = PromptStyle MutedStyle = UnfocusedStyle BorderStyle = BoxStyle )
Unified Design System Styles
Functions ¶
func CheckboxSelection ¶
func CheckboxSelection(title string, options []CheckboxOption) ([]string, error)
CheckboxSelection displays a checkbox selection interface and returns selected values
func ListSelection ¶
ListSelection runs a list selection and returns the selected item
func NewCheckboxModel ¶
func NewCheckboxModel(title string, options []CheckboxOption) checkboxModel
NewCheckboxModel creates a new checkbox selection model
func NewListModel ¶
NewListModel creates a new list selection model
func RadioSelection ¶ added in v0.1.1
func RadioSelection(title string, options []RadioOption, defaultSelection int) (string, error)
RadioSelection displays a radio button selection interface and returns the selected value
func ReadMultilineInput ¶
ReadMultilineInput reads multi-line input until Ctrl+D
func RenderBadge ¶ added in v0.1.1
RenderBadge renders a status badge
func RenderCheckbox ¶
RenderCheckbox renders a checkbox with consistent styling
func RenderCheckboxLegacy ¶ added in v0.1.1
Legacy compatibility functions
func RenderHelp ¶ added in v0.1.1
RenderHelp renders help text with consistent formatting
func RenderProgress ¶
RenderProgress renders a progress indicator
func RenderRadio ¶ added in v0.1.1
RenderRadio renders a radio button with consistent styling
func RenderStep ¶ added in v0.1.1
RenderStep renders a step indicator (e.g., "Step 1 of 2")
Types ¶
type CheckboxOption ¶
CheckboxOption represents a single checkbox option