https://github.com/ivanvc/bubble-marquee
Marquee bubble component
https://github.com/ivanvc/bubble-marquee
bubble bubbletea charmbracelet terminal tui
Last synced: 3 months ago
JSON representation
Marquee bubble component
- Host: GitHub
- URL: https://github.com/ivanvc/bubble-marquee
- Owner: ivanvc
- License: mit
- Created: 2023-11-17T23:22:50.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-20T21:38:35.000Z (almost 2 years ago)
- Last Synced: 2024-10-14T10:24:58.479Z (12 months ago)
- Topics: bubble, bubbletea, charmbracelet, terminal, tui
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Marquee Bubble
A simple [BubbleTea] bubble component to generate marquees.

[BubbleTea]: https://github.com/charmbracelet/bubbletea
## Usage
First, initialize a new marquee, then set the text to display, and optionally
the width. If width is not defined, it's assumed from the text's length.```go
func NewMyModel() MyModel {
m := marquee.New()
m.SetText("Hello World")
m.SetWidth(100) // optional
return MyModel{marquee: m}
}
```It supports two scrolling directions, left and right.
```go
m.ScrollDirection = marquee.Right
```You can also specify the scrolling speed (defaults to 250ms).
```go
m.ScrollSpeed = 50 * time.Millisecond
```And you can make it continuous:
```go
m.SetContinuous(true)
```Then, call scroll in your `Init()`.
```go
func(m MyModel) Init() tea.Cmd {
return m.marquee.Scroll
}
```That's it. Check the documentation and the [example](example/) directory for
more detailed usage.## License
See [LICENSE](LICENSE).