Documentation
¶
Index ¶
- Variables
- type Checklist
- func (c *Checklist) AddItem(item ChecklistItem)
- func (c *Checklist) Blur()
- func (c *Checklist) CompletionCount() (done int, total int)
- func (c *Checklist) Focus()
- func (c *Checklist) Focused() bool
- func (c *Checklist) GetItem(id string) *ChecklistItem
- func (c *Checklist) Init() tea.Cmd
- func (c *Checklist) ItemCount() int
- func (c *Checklist) RemoveItem(id string)
- func (c *Checklist) SetExpanded(id string, expanded bool)
- func (c *Checklist) SetItemStatus(id string, status ChecklistItemStatus)
- func (c *Checklist) ToggleItem(id string)
- func (c *Checklist) Update(msg tea.Msg) (tui.Component, tea.Cmd)
- func (c *Checklist) View() string
- type ChecklistItem
- type ChecklistItemStatus
- type ChecklistOption
- func WithChecklistDesignTokens(tokens *design.DesignTokens) ChecklistOption
- func WithChecklistIconSet(iconSet IconSet) ChecklistOption
- func WithChecklistItems(items ...ChecklistItem) ChecklistOption
- func WithChecklistTheme(theme string) ChecklistOption
- func WithChecklistTitle(title string) ChecklistOption
- func WithShowProgress(show bool) ChecklistOption
- type Command
- type CommandPalette
- func (cp *CommandPalette) Blur()
- func (cp *CommandPalette) Focus()
- func (cp *CommandPalette) Focused() bool
- func (cp *CommandPalette) Hide()
- func (cp *CommandPalette) Init() tea.Cmd
- func (cp *CommandPalette) IsVisible() bool
- func (cp *CommandPalette) Show()
- func (cp *CommandPalette) Update(msg tea.Msg) (tui.Component, tea.Cmd)
- func (cp *CommandPalette) View() string
- type CommandPaletteOption
- type FloatingPalette
- func (fp *FloatingPalette) Blur()
- func (fp *FloatingPalette) Focus()
- func (fp *FloatingPalette) Focused() bool
- func (fp *FloatingPalette) GetSelectedCommand() *PaletteCommand
- func (fp *FloatingPalette) Hide()
- func (fp *FloatingPalette) Init() tea.Cmd
- func (fp *FloatingPalette) IsVisible() bool
- func (fp *FloatingPalette) SetCommands(cmds []PaletteCommand)
- func (fp *FloatingPalette) Show()
- func (fp *FloatingPalette) Toggle()
- func (fp *FloatingPalette) Update(msg tea.Msg) (tui.Component, tea.Cmd)
- func (fp *FloatingPalette) View() string
- type FloatingPaletteOption
- func WithFloatingPaletteDesignTokens(tokens *design.DesignTokens) FloatingPaletteOption
- func WithFloatingPaletteMargin(margin int) FloatingPaletteOption
- func WithFloatingPaletteMaxResults(n int) FloatingPaletteOption
- func WithFloatingPalettePrompt(prompt string) FloatingPaletteOption
- func WithFloatingPaletteTheme(theme string) FloatingPaletteOption
- type IconSet
- type KeyBinding
- type KeyOverlay
- func (ko *KeyOverlay) AddBinding(key, desc, category string)
- func (ko *KeyOverlay) AddBindings(bindings []KeyBinding)
- func (ko *KeyOverlay) Blur()
- func (ko *KeyOverlay) Focus()
- func (ko *KeyOverlay) Focused() bool
- func (ko *KeyOverlay) Init() tea.Cmd
- func (ko *KeyOverlay) SetVisible(visible bool)
- func (ko *KeyOverlay) Toggle()
- func (ko *KeyOverlay) Update(msg tea.Msg) (tui.Component, tea.Cmd)
- func (ko *KeyOverlay) View() string
- func (ko *KeyOverlay) Visible() bool
- type KeyOverlayOption
- type PaletteCommand
- type PaletteDismissMsg
- type PaletteSelectMsg
- type Spinner
- type TextInput
- func (t *TextInput) Blur()
- func (t *TextInput) Focus()
- func (t *TextInput) Focused() bool
- func (t *TextInput) Init() tea.Cmd
- func (t *TextInput) OnSubmit(fn func(string) tea.Cmd)
- func (t *TextInput) Reset()
- func (t *TextInput) SetValue(value string)
- func (t *TextInput) Update(msg tea.Msg) (tui.Component, tea.Cmd)
- func (t *TextInput) Value() string
- func (t *TextInput) View() string
Constants ¶
This section is empty.
Variables ¶
var ( // IconSetSymbols - Unicode symbols. IconSetSymbols = IconSet{ Running: "⏺", Success: "✓", Error: "✗", Warning: "⚠", Info: "ℹ", None: "⏺", } )
var ( // SpinnerDots - Braille dots spinner (smooth). SpinnerDots = Spinner{ Frames: []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}, } )
Functions ¶
This section is empty.
Types ¶
type Checklist ¶
type Checklist struct {
// contains filtered or unexported fields
}
Checklist displays a navigable list of checklist items.
func NewChecklist ¶
func NewChecklist(opts ...ChecklistOption) *Checklist
NewChecklist creates a new checklist component.
func (*Checklist) AddItem ¶
func (c *Checklist) AddItem(item ChecklistItem)
AddItem appends an item to the checklist.
func (*Checklist) CompletionCount ¶
CompletionCount returns completed and total item counts.
Completed includes all non-pending statuses.
func (*Checklist) GetItem ¶
func (c *Checklist) GetItem(id string) *ChecklistItem
GetItem returns a pointer to the item with a matching ID.
func (*Checklist) RemoveItem ¶
RemoveItem removes a checklist item by ID.
func (*Checklist) SetExpanded ¶
SetExpanded sets one item's expanded state by ID.
func (*Checklist) SetItemStatus ¶
func (c *Checklist) SetItemStatus(id string, status ChecklistItemStatus)
SetItemStatus sets a checklist item's status by ID.
func (*Checklist) ToggleItem ¶
ToggleItem toggles a checklist item between done and pending.
type ChecklistItem ¶
type ChecklistItem struct {
ID string
Label string
Status ChecklistItemStatus
Children []ChecklistItem
Expanded bool
}
ChecklistItem is one checklist entry and optional nested children.
type ChecklistItemStatus ¶
type ChecklistItemStatus int
ChecklistItemStatus represents one checklist item's execution state.
const ( ItemPending ChecklistItemStatus = iota ItemInProgress ItemDone ItemSkipped ItemFailed )
type ChecklistOption ¶
type ChecklistOption func(*Checklist)
ChecklistOption configures a Checklist.
func WithChecklistDesignTokens ¶
func WithChecklistDesignTokens(tokens *design.DesignTokens) ChecklistOption
WithChecklistDesignTokens applies design-system colors.
func WithChecklistIconSet ¶
func WithChecklistIconSet(iconSet IconSet) ChecklistOption
WithChecklistIconSet sets status icons.
func WithChecklistItems ¶
func WithChecklistItems(items ...ChecklistItem) ChecklistOption
WithChecklistItems sets the initial checklist items.
func WithChecklistTheme ¶
func WithChecklistTheme(theme string) ChecklistOption
WithChecklistTheme applies a named design-system theme.
func WithChecklistTitle ¶
func WithChecklistTitle(title string) ChecklistOption
WithChecklistTitle sets the checklist title.
func WithShowProgress ¶
func WithShowProgress(show bool) ChecklistOption
WithShowProgress toggles progress display in the title row.
type Command ¶
type Command struct {
Name string // Display name of the command
Description string // Brief description of what the command does
Category string // Category for grouping (e.g., "File", "Edit", "View")
Action func() tea.Cmd // Function to execute when command is selected
Keybinding string // Optional keyboard shortcut (e.g., "Ctrl+S")
}
Command represents an executable command in the command palette with metadata for display and categorization.
type CommandPalette ¶
type CommandPalette struct {
// contains filtered or unexported fields
}
CommandPalette is a searchable command launcher inspired by VS Code's command palette. It provides a popup interface for quickly executing commands via keyboard.
func NewCommandPalette ¶
func NewCommandPalette(commands []Command, opts ...CommandPaletteOption) *CommandPalette
NewCommandPalette creates a new command palette with the given list of commands.
func (*CommandPalette) Blur ¶
func (cp *CommandPalette) Blur()
Blur is called when this component loses focus.
func (*CommandPalette) Focus ¶
func (cp *CommandPalette) Focus()
Focus is called when this component receives focus.
func (*CommandPalette) Focused ¶
func (cp *CommandPalette) Focused() bool
Focused returns whether this component is currently focused.
func (*CommandPalette) Init ¶
func (cp *CommandPalette) Init() tea.Cmd
Init initializes the command palette.
func (*CommandPalette) IsVisible ¶
func (cp *CommandPalette) IsVisible() bool
IsVisible returns whether the palette is currently visible.
func (*CommandPalette) View ¶
func (cp *CommandPalette) View() string
View renders the command palette.
type CommandPaletteOption ¶ added in v2.11.0
type CommandPaletteOption func(*CommandPalette)
CommandPaletteOption configures a CommandPalette.
func WithCommandPaletteDesignTokens ¶ added in v2.11.0
func WithCommandPaletteDesignTokens(tokens *design.DesignTokens) CommandPaletteOption
WithCommandPaletteDesignTokens applies design-system colors.
type FloatingPalette ¶
type FloatingPalette struct {
// contains filtered or unexported fields
}
FloatingPalette is a centered floating command palette overlay.
func NewFloatingPalette ¶
func NewFloatingPalette(commands []PaletteCommand, opts ...FloatingPaletteOption) *FloatingPalette
NewFloatingPalette creates a floating command palette component.
func (*FloatingPalette) Blur ¶
func (fp *FloatingPalette) Blur()
Blur marks the palette as unfocused.
func (*FloatingPalette) Focus ¶
func (fp *FloatingPalette) Focus()
Focus marks the palette as focused.
func (*FloatingPalette) Focused ¶
func (fp *FloatingPalette) Focused() bool
Focused returns whether the palette has focus.
func (*FloatingPalette) GetSelectedCommand ¶
func (fp *FloatingPalette) GetSelectedCommand() *PaletteCommand
GetSelectedCommand returns the currently selected filtered command.
func (*FloatingPalette) Init ¶
func (fp *FloatingPalette) Init() tea.Cmd
Init initializes the component.
func (*FloatingPalette) IsVisible ¶
func (fp *FloatingPalette) IsVisible() bool
IsVisible returns whether the palette is visible.
func (*FloatingPalette) SetCommands ¶
func (fp *FloatingPalette) SetCommands(cmds []PaletteCommand)
SetCommands updates the command list and reapplies filtering.
func (*FloatingPalette) Show ¶
func (fp *FloatingPalette) Show()
Show makes the palette visible and resets filter state.
func (*FloatingPalette) View ¶
func (fp *FloatingPalette) View() string
View renders the floating palette overlay.
type FloatingPaletteOption ¶
type FloatingPaletteOption func(*FloatingPalette)
FloatingPaletteOption configures a FloatingPalette.
func WithFloatingPaletteDesignTokens ¶
func WithFloatingPaletteDesignTokens(tokens *design.DesignTokens) FloatingPaletteOption
WithFloatingPaletteDesignTokens applies design-system colors.
func WithFloatingPaletteMargin ¶
func WithFloatingPaletteMargin(margin int) FloatingPaletteOption
WithFloatingPaletteMargin sets the horizontal margin on each side.
func WithFloatingPaletteMaxResults ¶
func WithFloatingPaletteMaxResults(n int) FloatingPaletteOption
WithFloatingPaletteMaxResults sets the maximum number of visible results.
func WithFloatingPalettePrompt ¶
func WithFloatingPalettePrompt(prompt string) FloatingPaletteOption
WithFloatingPalettePrompt sets the input prompt.
func WithFloatingPaletteTheme ¶
func WithFloatingPaletteTheme(theme string) FloatingPaletteOption
WithFloatingPaletteTheme applies a named design-system theme.
type IconSet ¶
type IconSet struct {
Running string
Success string
Error string
Warning string
Info string
None string
}
IconSet defines icons for different statuses.
type KeyBinding ¶ added in v2.3.0
KeyBinding represents a keyboard shortcut and its purpose.
type KeyOverlay ¶ added in v2.3.0
type KeyOverlay struct {
// contains filtered or unexported fields
}
KeyOverlay is a centered help overlay that lists available shortcuts.
func NewKeyOverlay ¶ added in v2.3.0
func NewKeyOverlay(opts ...KeyOverlayOption) *KeyOverlay
NewKeyOverlay creates a new KeyOverlay.
func (*KeyOverlay) AddBinding ¶ added in v2.3.0
func (ko *KeyOverlay) AddBinding(key, desc, category string)
AddBinding appends a single key binding.
func (*KeyOverlay) AddBindings ¶ added in v2.3.0
func (ko *KeyOverlay) AddBindings(bindings []KeyBinding)
AddBindings appends multiple key bindings.
func (*KeyOverlay) Blur ¶ added in v2.3.0
func (ko *KeyOverlay) Blur()
Blur marks the overlay as unfocused.
func (*KeyOverlay) Focus ¶ added in v2.3.0
func (ko *KeyOverlay) Focus()
Focus marks the overlay as focused.
func (*KeyOverlay) Focused ¶ added in v2.3.0
func (ko *KeyOverlay) Focused() bool
Focused reports whether the overlay is focused.
func (*KeyOverlay) Init ¶ added in v2.3.0
func (ko *KeyOverlay) Init() tea.Cmd
Init initializes the overlay.
func (*KeyOverlay) SetVisible ¶ added in v2.3.0
func (ko *KeyOverlay) SetVisible(visible bool)
SetVisible sets whether the overlay is visible.
func (*KeyOverlay) Toggle ¶ added in v2.3.0
func (ko *KeyOverlay) Toggle()
Toggle flips the current visibility.
func (*KeyOverlay) View ¶ added in v2.3.0
func (ko *KeyOverlay) View() string
View renders the overlay if visible.
func (*KeyOverlay) Visible ¶ added in v2.3.0
func (ko *KeyOverlay) Visible() bool
Visible reports whether the overlay is visible.
type KeyOverlayOption ¶ added in v2.3.0
type KeyOverlayOption func(*KeyOverlay)
KeyOverlayOption configures a KeyOverlay.
func WithKeyOverlayBindings ¶ added in v2.3.0
func WithKeyOverlayBindings(bindings []KeyBinding) KeyOverlayOption
WithKeyOverlayBindings sets initial key bindings.
func WithKeyOverlayTitle ¶ added in v2.3.0
func WithKeyOverlayTitle(title string) KeyOverlayOption
WithKeyOverlayTitle sets the overlay title.
func WithKeyOverlayWidth ¶ added in v2.3.0
func WithKeyOverlayWidth(width int) KeyOverlayOption
WithKeyOverlayWidth sets the preferred overlay width.
type PaletteCommand ¶
type PaletteCommand struct {
Name string // command name e.g. 'diff'
Description string // description text
Shortcut string // optional keyboard shortcut hint
}
PaletteCommand is a command shown in the floating command palette.
type PaletteDismissMsg ¶
type PaletteDismissMsg struct{}
PaletteDismissMsg is emitted when the palette is dismissed.
type PaletteSelectMsg ¶
type PaletteSelectMsg struct {
Command PaletteCommand
}
PaletteSelectMsg is emitted when a command selection is confirmed.
type TextInput ¶
type TextInput struct {
// contains filtered or unexported fields
}
TextInput is a multi-line text input component for user messages.
func (*TextInput) Focus ¶
func (t *TextInput) Focus()
Focus is called when this component receives focus.