Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ignoxx/bubbles
some bubbletea compatible component collection
https://github.com/ignoxx/bubbles
bubbletea charm cli go golang huh tui
Last synced: 30 days ago
JSON representation
some bubbletea compatible component collection
- Host: GitHub
- URL: https://github.com/ignoxx/bubbles
- Owner: ignoxx
- Created: 2024-11-19T16:51:04.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-19T19:30:24.000Z (about 1 month ago)
- Last Synced: 2024-11-19T20:27:14.443Z (about 1 month ago)
- Topics: bubbletea, charm, cli, go, golang, huh, tui
- Language: Go
- Homepage:
- Size: 115 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bubbles
some custom bubbletea components## Components
### Multiselect with groups
Like [huh's](https://github.com/charmbracelet/huh) Multiselect but with groups that you seamlessly jump between
![multiselectgroup.gif](./gifs/multiselectgroup.gif)```go
package mainimport (
"fmt"tea "github.com/charmbracelet/bubbletea"
mg "github.com/ignoxx/bubbles/multiselectgroup"
)func main() {
ms := mg.NewMultiSelectGroup(
mg.Group[string]{
ID: "Group 1",
Options: []mg.Option[string]{
{ID: "s1", Name: "selection 1"},
{ID: "s2", Name: "selection 2"},
{ID: "s3", Name: "selection 3"},
{ID: "s4", Name: "selection 4"},
},
},
mg.Group[string]{
ID: "Group 2",
Options: []mg.Option[string]{
{ID: "s5", Name: "selection 5"},
},
},
mg.Group[string]{
ID: "Group 3",
Options: []mg.Option[string]{
{ID: "s6", Name: "selection 6"},
{ID: "s7", Name: "selection 7"},
{ID: "s8", Name: "selection 8"},
},
},
mg.Group[string]{
ID: "Group 4",
Options: []mg.Option[string]{
{ID: "s9", Name: "selection 9"},
{ID: "s10", Name: "selection 10"},
{ID: "s11", Name: "selection 11"},
{ID: "s12", Name: "selection 12"},
{ID: "s13", Name: "selection 13"},
{ID: "s14", Name: "selection 14"},
},
},
)// save final result
var results []mg.Option[string]
ms.Value(&results)if _, err := tea.NewProgram(ms).Run(); err != nil {
panic(err)
}fmt.Println("Result:")
for _, option := range results {
fmt.Printf("%s: %t\n", option.ID, option.Selected)
}
}
```