Documentation ¶
Index ¶
- Variables
- type Button
- type ButtonStyles
- type KeyMap
- type Model
- func (m Model) Init() tea.Cmd
- func (m Model) NextButton() Model
- func (m Model) PreviousButton() Model
- func (m Model) SetButton(i int) Model
- func (m Model) Styles(styles Styles) Model
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m Model) View() string
- func (m Model) Wraparound(w bool) Model
- type RadioButtonMsg
- type Styles
Constants ¶
This section is empty.
Variables ¶
var ( DefaultUnfocusedColor = gloss.AdaptiveColor{Light: "#3a3a3a", Dark: "#b0b0b0"} DefaultActiveButtonIndicatorColor = gloss.AdaptiveColor{Light: "#bb99fe", Dark: "#997bf6"} // ╭───╮ // │foo│ // ╰───╯ DefaultPillBorder = gloss.Border{ Top: "─", Bottom: "─", Left: "│", Right: "│", TopLeft: "╭", TopRight: "╮", BottomLeft: "╰", BottomRight: "╯", } // ╭───┬ // │foo│ // ╰───┴ DefaultGroupedHorizontalFirstBorder = gloss.Border{ Top: "─", Bottom: "─", Left: "│", Right: "│", TopLeft: "╭", TopRight: "┬", BottomLeft: "╰", BottomRight: "┴", } // ───┬ // foo│ // ───┴ DefaultGroupedHorizontalBorder = gloss.Border{ Top: "─", Bottom: "─", Left: "", Right: "│", TopLeft: "", TopRight: "┬", BottomLeft: "", BottomRight: "┴", } // ───╮ // foo│ // ───╯ DefaultGroupedHorizontalLastBorder = gloss.Border{ Top: "─", Bottom: "─", Left: "", Right: "│", TopLeft: "", TopRight: "╮", BottomLeft: "", BottomRight: "╯", } // ┌───┐ // │foo│ // ├───┤ DefaultGroupedVerticalFirstBorder = gloss.Border{ Top: "─", Bottom: "─", Left: "│", Right: "│", TopLeft: "╭", TopRight: "╮", BottomLeft: "├", BottomRight: "┤", } // │foo│ // ├───┤ DefaultGroupedVerticalBorder = gloss.Border{ Top: "", Bottom: "─", Left: "│", Right: "│", TopLeft: "", TopRight: "", BottomLeft: "├", BottomRight: "┤", } // │foo│ // ╰───╯ DefaultGroupedVerticalLastBorder = gloss.Border{ Top: "", Bottom: "─", Left: "│", Right: "│", TopLeft: "", TopRight: "", BottomLeft: "╰", BottomRight: "╯", } )
Functions ¶
This section is empty.
Types ¶
type Button ¶
type Button struct {
// contains filtered or unexported fields
}
Button represents a single radio button. It provides basic handling of radio-button-state. However, a user-defined model may be passed into the Model instead if custom behavior is needed.
func (Button) Styles ¶
func (m Button) Styles(styles ButtonStyles) Button
Styles sets custom styling.
type ButtonStyles ¶
type ButtonStyles struct { // Character(s) to left of the button label/content LeftIndicatorCharacter string // Character(s) to left of the action button label/content ActiveLeftIndicatorCharacter string // Character(s) to right of the button label/content RightIndicatorCharacter string // Character(s) to right of the active button label/content ActiveRightIndicatorCharacter string // Area to the left of the button label/content LeftIndicator gloss.Style // Area to the left of the active button label/content ActiveLeftIndicator gloss.Style // Area to the right of the button label/content RightIndicator gloss.Style // Area to the right of the active button label/content ActiveRightIndicator gloss.Style // Label/content for the button Label gloss.Style // Label/content for the active button ActiveLabel gloss.Style }
Styles for rendering the interior of the button itself.
func DefaultButtonStyles ¶
func DefaultButtonStyles() ButtonStyles
DefaultButtonStyles provides default styles for a button.
type KeyMap ¶
KeyMap contains relevant keys for button navigation.
func DefaultKeyMap ¶
defaultKeyMap contains default key mappings for radio group navigation.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model represents a group of radio buttons.
func (Model) NextButton ¶
NextButton moves the active button forward.
func (Model) PreviousButton ¶
PreviousButton moves the active button backward.
func (Model) Wraparound ¶
Wraparound enables or disables wraparound navigation from the last button to the first button and from the first button back to the last button.
type RadioButtonMsg ¶
type RadioButtonMsg struct { // State is whether or not the radio button is active State bool // User-defined data to pass down into the button Data any }
RadioButtonMsg enables communication down into radio buttons
type Styles ¶
Styles for button rendering.
DefaultStyles and DefaultPillStyles only really use Button. DefaultGroupedStyles uses all three button styles for grouped rendering.
func DefaultGroupedStyles ¶
DefaultGroupedStyles provides default button grouped styles.
func DefaultPillStyles ¶
DefaultPillStyles provides default button pill styles.
func DefaultStyles ¶
DefaultStyles provides default button styles.