Documentation ¶
Index ¶
- type KeyMap
- type Model
- func (m *Model) Blur()
- func (m Model) Cursor() int
- func (m *Model) Focus()
- func (m Model) Focused() bool
- func (m Model) Height() int
- func (m Model) Items() []string
- func (m *Model) MoveLeft()
- func (m *Model) MoveRight()
- func (m Model) SelectedItem() string
- func (m *Model) SetCursor(n int)
- func (m *Model) SetHeight(h int)
- func (m *Model) SetItems(items []string)
- func (m *Model) SetStyles(s Styles)
- func (m *Model) SetWidth(w int)
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m *Model) UpdateSize()
- func (m Model) View() string
- func (m Model) Width() int
- type Option
- type Styles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyMap ¶
KeyMap defines keybindings. It satisfies to the help.KeyMap interface, which is used to render the menu.
func DefaultKeyMap ¶
func DefaultKeyMap() KeyMap
DefaultKeyMap returns a default set of keybindings.
type Model ¶
type Model struct { KeyMap KeyMap // contains filtered or unexported fields }
Model defines a state for the carousel widget.
func (*Model) Blur ¶
func (m *Model) Blur()
Blur blurs the carousel, preventing selection or movement.
func (*Model) Focus ¶
func (m *Model) Focus()
Focus focuses the carousel, allowing the user to move around the items and interact.
func (*Model) MoveLeft ¶
func (m *Model) MoveLeft()
MoveLeft moves the selection left by one item.. It can not go before the first item.
func (*Model) MoveRight ¶
func (m *Model) MoveRight()
MoveDown moves the selection right by one item. It can not go after the last row.
func (Model) SelectedItem ¶
SelectedItem returns the selected item. You can cast it to your own implementation.
func (*Model) UpdateSize ¶
func (m *Model) UpdateSize()
UpdateSize updates the carousel size based on the previously defined items and width.
type Option ¶
type Option func(*Model)
Option is used to set options in New. For example:
carousel := New(WithItems([]string{"Item 1", "Item 2", "Item 3"}))
func WithEvenlySpacedItems ¶
func WithEvenlySpacedItems() Option
WithEvenlySpacedItems sets all items with the same width.
func WithFocused ¶
WithFocused sets the focus state of the carousel.
type Styles ¶
Styles contains style definitions for this carousel component. By default, vthese alues are generated by DefaultStyles.
func DefaultStyles ¶
func DefaultStyles() Styles
DefaultStyles returns a set of default style definitions for this carousel.