[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1131":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":35,"readmeContent":36,"aiSummary":37,"trendingCount":16,"starSnapshotCount":16,"syncStatus":38,"lastSyncTime":39,"discoverSource":40},1131,"bubbletea","charmbracelet\u002Fbubbletea","charmbracelet","A powerful little TUI framework 🏗","",null,"Go",43051,1225,140,104,0,16,173,758,106,44.27,"MIT License",false,"main",true,[27,28,29,30,31,32,33,34],"cli","elm-architecture","framework","functional","go","golang","hacktoberfest","tui","2026-06-12 02:00:23","# Bubble Tea\n\n\u003Cp>\n    \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fad408275-8799-488f-9303-441e7f869535\" width=\"350\">\u003Cbr>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbletea\u002Freleases\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Fcharmbracelet\u002Fbubbletea.svg\" alt=\"Latest Release\">\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fpkg.go.dev\u002Fcharm.land\u002Fbubbletea\u002Fv2?tab=doc\">\u003Cimg src=\"https:\u002F\u002Fgodoc.org\u002Fcharm.land\u002Fbubbletea\u002Fv2?status.svg\" alt=\"GoDoc\">\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbletea\u002Factions\">\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbletea\u002Factions\u002Fworkflows\u002Fbuild.yml\u002Fbadge.svg?branch=main\" alt=\"Build Status\">\u003C\u002Fa>\n\u003C\u002Fp>\n\nThe fun, functional and stateful way to build terminal apps. A Go framework\nbased on [The Elm Architecture][elm]. Bubble Tea is well-suited for simple and\ncomplex terminal applications, either inline, full-window, or a mix of both.\n\n\u003Cp>\n    \u003Cimg src=\"https:\u002F\u002Fstuff.charm.sh\u002Fbubbletea\u002Fbubbletea-example.gif\" width=\"100%\" alt=\"Bubble Tea Example\">\n\u003C\u002Fp>\n\nBubble Tea is in use in production and includes a number of features and\nperformance optimizations we’ve added along the way. Among those is\na high-performance cell-based renderer, built-in color downsampling,\ndeclarative views, high-fidelity keyboard and mouse handling, native clipboard\nsupport, and more.\n\nTo get started, see the tutorial below, the [examples][examples], the\n[docs][docs], and some common [resources](#libraries-we-use-with-bubble-tea).\n\n> [!TIP]\n>\n> Upgrading from v1? Check out the [upgrade guide](.\u002FUPGRADE_GUIDE_V2.md), or\n> point your LLM at it and let it go to town.\n\n## By the way\n\nBe sure to check out [Bubbles][bubbles], a library of common UI components for Bubble Tea.\n\n\u003Cp>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbles\">\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fb6dc4638-b67a-4bfa-88d0-a8e8833c3ac9\" width=\"172\" alt=\"Bubbles Badge\">\u003C\u002Fa>&nbsp;&nbsp;\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbles\">\u003Cimg src=\"https:\u002F\u002Fstuff.charm.sh\u002Fbubbles-examples\u002Ftextinput.gif\" width=\"400\" alt=\"Text Input Example from Bubbles\">\u003C\u002Fa>\n\u003C\u002Fp>\n\n---\n\n## Tutorial\n\nBubble Tea is based on the functional design paradigms of [The Elm\nArchitecture][elm], which happens to work nicely with Go. It's a delightful way\nto build applications.\n\nThis tutorial assumes you have a working knowledge of Go.\n\nBy the way, the non-annotated source code for this program is available\n[on GitHub][tut-source].\n\n[elm]: https:\u002F\u002Fguide.elm-lang.org\u002Farchitecture\u002F\n[tut-source]: https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbletea\u002Ftree\u002Fmain\u002Ftutorials\u002Fbasics\n\n### Enough! Let's get to it.\n\nFor this tutorial, we're making a shopping list.\n\nTo start we'll define our package and import some libraries. Our only external\nimport will be the Bubble Tea library, which we'll call `tea` for short.\n\n```go\npackage main\n\n\u002F\u002F These imports will be used later in the tutorial. If you save the file\n\u002F\u002F now, Go might complain they are unused, but that's fine.\n\u002F\u002F You may also need to run `go mod tidy` to download bubbletea and its\n\u002F\u002F dependencies.\nimport (\n    \"fmt\"\n    \"os\"\n\n    tea \"charm.land\u002Fbubbletea\u002Fv2\"\n)\n```\n\nBubble Tea programs are comprised of a **model** that describes the application\nstate and three simple methods on that model:\n\n- **Init**, a function that returns an initial command for the application to run.\n- **Update**, a function that handles incoming events and updates the model accordingly.\n- **View**, a function that renders the UI based on the data in the model.\n\n### The Model\n\nSo let's start by defining our model which will store our application's state.\nIt can be any type, but a `struct` usually makes the most sense.\n\n```go\ntype model struct {\n    choices  []string           \u002F\u002F items on the to-do list\n    cursor   int                \u002F\u002F which to-do list item our cursor is pointing at\n    selected map[int]struct{}   \u002F\u002F which to-do items are selected\n}\n```\n\n## Initialization\n\nNext, we’ll define our application’s initial state. `Init` can return a `Cmd`\nthat could perform some initial I\u002FO. For now, we don’t need to do any I\u002FO, so\nfor the command, we’ll just return `nil`, which translates to “no command.”\n\n```go\nfunc initialModel() model {\n\treturn model{\n\t\t\u002F\u002F Our to-do list is a grocery list\n\t\tchoices:  []string{\"Buy carrots\", \"Buy celery\", \"Buy kohlrabi\"},\n\n\t\t\u002F\u002F A map which indicates which choices are selected. We're using\n\t\t\u002F\u002F the  map like a mathematical set. The keys refer to the indexes\n\t\t\u002F\u002F of the `choices` slice, above.\n\t\tselected: make(map[int]struct{}),\n\t}\n}\n```\n\nAfter that, we’ll define our application’s initial state in the `Init` method. `Init`\ncan return a `Cmd` that could perform some initial I\u002FO. For now, we don't need\nto do any I\u002FO, so for the command, we'll just return `nil`, which translates to\n\"no command.\"\n\n```go\nfunc (m model) Init() tea.Cmd {\n    \u002F\u002F Just return `nil`, which means \"no I\u002FO right now, please.\"\n    return nil\n}\n```\n\n### The Update Method\n\nNext up is the update method. The update function is called when “things\nhappen.” Its job is to look at what has happened and return an updated model in\nresponse. It can also return a `Cmd` to make more things happen, but for now\ndon't worry about that part.\n\nIn our case, when a user presses the down arrow, `Update`’s job is to notice\nthat the down arrow was pressed and move the cursor accordingly (or not).\n\nThe “something happened” comes in the form of a `Msg`, which can be any type.\nMessages are the result of some I\u002FO that took place, such as a keypress, timer\ntick, or a response from a server.\n\nWe usually figure out which type of `Msg` we received with a type switch, but\nyou could also use a type assertion.\n\nFor now, we'll just deal with `tea.KeyPressMsg` messages, which are\nautomatically sent to the update function when keys are pressed.\n\n```go\nfunc (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {\n    switch msg := msg.(type) {\n\n    \u002F\u002F Is it a key press?\n    case tea.KeyPressMsg:\n\n        \u002F\u002F Cool, what was the actual key pressed?\n        switch msg.String() {\n\n        \u002F\u002F These keys should exit the program.\n        case \"ctrl+c\", \"q\":\n            return m, tea.Quit\n\n        \u002F\u002F The \"up\" and \"k\" keys move the cursor up\n        case \"up\", \"k\":\n            if m.cursor > 0 {\n                m.cursor--\n            }\n\n        \u002F\u002F The \"down\" and \"j\" keys move the cursor down\n        case \"down\", \"j\":\n            if m.cursor \u003C len(m.choices)-1 {\n                m.cursor++\n            }\n\n        \u002F\u002F The \"enter\" key and the space bar toggle the selected state\n        \u002F\u002F for the item that the cursor is pointing at.\n        case \"enter\", \"space\":\n            _, ok := m.selected[m.cursor]\n            if ok {\n                delete(m.selected, m.cursor)\n            } else {\n                m.selected[m.cursor] = struct{}{}\n            }\n        }\n    }\n\n    \u002F\u002F Return the updated model to the Bubble Tea runtime for processing.\n    \u002F\u002F Note that we're not returning a command.\n    return m, nil\n}\n```\n\nYou may have noticed that \u003Ckbd>ctrl+c\u003C\u002Fkbd> and \u003Ckbd>q\u003C\u002Fkbd> above return\na `tea.Quit` command with the model. That’s a special command which instructs\nthe Bubble Tea runtime to quit, exiting the program.\n\n### The View Method\n\nAt last, it’s time to render our UI. Of all the methods, the view is the\nsimplest. We look at the model in its current state and use it to build a\n`tea.View`. The view declares our UI content and, optionally, terminal features\nlike alt screen mode, mouse tracking, cursor position, and more.\n\nBecause the view describes the entire UI of your application, you don’t have to\nworry about redrawing logic and stuff like that. Bubble Tea takes care of it\nfor you.\n\n```go\nfunc (m model) View() tea.View {\n    \u002F\u002F The header\n    s := \"What should we buy at the market?\\n\\n\"\n\n    \u002F\u002F Iterate over our choices\n    for i, choice := range m.choices {\n\n        \u002F\u002F Is the cursor pointing at this choice?\n        cursor := \" \" \u002F\u002F no cursor\n        if m.cursor == i {\n            cursor = \">\" \u002F\u002F cursor!\n        }\n\n        \u002F\u002F Is this choice selected?\n        checked := \" \" \u002F\u002F not selected\n        if _, ok := m.selected[i]; ok {\n            checked = \"x\" \u002F\u002F selected!\n        }\n\n        \u002F\u002F Render the row\n        s += fmt.Sprintf(\"%s [%s] %s\\n\", cursor, checked, choice)\n    }\n\n    \u002F\u002F The footer\n    s += \"\\nPress q to quit.\\n\"\n\n    \u002F\u002F Send the UI for rendering\n    return tea.NewView(s)\n}\n```\n\n### All Together Now\n\nThe last step is to simply run our program. We pass our initial model to\n`tea.NewProgram` and let it rip:\n\n```go\nfunc main() {\n    p := tea.NewProgram(initialModel())\n    if _, err := p.Run(); err != nil {\n        fmt.Printf(\"Alas, there's been an error: %v\", err)\n        os.Exit(1)\n    }\n}\n```\n\n## What’s Next?\n\nThis tutorial covers the basics of building an interactive terminal UI, but\nin the real world you'll also need to perform I\u002FO. To learn about that have a\nlook at the [Command Tutorial][cmd]. It's pretty simple.\n\nThere are also several [Bubble Tea examples][examples] available and, of course,\nthere are [Go Docs][docs].\n\n[cmd]: https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbletea\u002Ftree\u002Fmain\u002Ftutorials\u002Fcommands\u002F\n[examples]: https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbletea\u002Ftree\u002Fmain\u002Fexamples\n[docs]: https:\u002F\u002Fpkg.go.dev\u002Fcharm.land\u002Fbubbletea\u002Fv2?tab=doc\n\n## Debugging\n\n### Debugging with Delve\n\nSince Bubble Tea apps assume control of stdin and stdout, you’ll need to run\ndelve in headless mode and then connect to it:\n\n```bash\n# Start the debugger\n$ dlv debug --headless --api-version=2 --listen=127.0.0.1:43000 .\nAPI server listening at: 127.0.0.1:43000\n\n# Connect to it from another terminal\n$ dlv connect 127.0.0.1:43000\n```\n\nIf you do not explicitly supply the `--listen` flag, the port used will vary\nper run, so passing this in makes the debugger easier to use from a script\nor your IDE of choice.\n\nAdditionally, we pass in `--api-version=2` because delve defaults to version 1\nfor backwards compatibility reasons. However, delve recommends using version 2\nfor all new development and some clients may no longer work with version 1.\nFor more information, see the [Delve documentation](https:\u002F\u002Fgithub.com\u002Fgo-delve\u002Fdelve\u002Ftree\u002Fmaster\u002FDocumentation\u002Fapi).\n\n### Logging Stuff\n\nYou can’t really log to stdout with Bubble Tea because your TUI is busy\noccupying that! You can, however, log to a file by including something like\nthe following prior to starting your Bubble Tea program:\n\n```go\nif len(os.Getenv(\"DEBUG\")) > 0 {\n\tf, err := tea.LogToFile(\"debug.log\", \"debug\")\n\tif err != nil {\n\t\tfmt.Println(\"fatal:\", err)\n\t\tos.Exit(1)\n\t}\n\tdefer f.Close()\n}\n```\n\nTo see what’s being logged in real time, run `tail -f debug.log` while you run\nyour program in another window.\n\n## Libraries we use with Bubble Tea\n\n- [Bubbles][bubbles]: Common Bubble Tea components such as text inputs, viewports, spinners and so on\n- [Lip Gloss][lipgloss]: Style, format and layout tools for terminal applications\n- [Harmonica][harmonica]: A spring animation library for smooth, natural motion\n- [BubbleZone][bubblezone]: Easy mouse event tracking for Bubble Tea components\n- [ntcharts][ntcharts]: A terminal charting library built for Bubble Tea and [Lip Gloss][lipgloss]\n\n[bubbles]: https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbles\n[lipgloss]: https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Flipgloss\n[harmonica]: https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fharmonica\n[bubblezone]: https:\u002F\u002Fgithub.com\u002Flrstanley\u002Fbubblezone\n[ntcharts]: https:\u002F\u002Fgithub.com\u002FNimbleMarkets\u002Fntcharts\n\n## Bubble Tea in the Wild\n\nThere are over [18,000 applications](https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbletea\u002Fnetwork\u002Fdependents) built with Bubble Tea! Here are a handful of ’em.\n\n### Staff favourites\n\n- [chezmoi](https:\u002F\u002Fgithub.com\u002Ftwpayne\u002Fchezmoi): securely manage your dotfiles across multiple machines\n- [circumflex](https:\u002F\u002Fgithub.com\u002Fbensadeh\u002Fcircumflex): read Hacker News in the terminal\n- [gh-dash](https:\u002F\u002Fwww.github.com\u002Fdlvhdr\u002Fgh-dash): a GitHub CLI extension for PRs and issues\n- [Tetrigo](https:\u002F\u002Fgithub.com\u002FBroderick-Westrope\u002Ftetrigo): Tetris in the terminal\n- [Signls](https:\u002F\u002Fgithub.com\u002Femprcl\u002Fsignls): a generative midi sequencer designed for composition and live performance\n- [Superfile](https:\u002F\u002Fgithub.com\u002Fyorukot\u002Fsuperfile): a super file manager\n\n### In Industry\n\n- Microsoft Azure – [Aztify](https:\u002F\u002Fgithub.com\u002FAzure\u002Faztfy): bring Microsoft Azure resources under Terraform\n- Daytona – [Daytona](https:\u002F\u002Fgithub.com\u002Fdaytonaio\u002Fdaytona): an AI infrastructure platform\n- Cockroach Labs – [CockroachDB](https:\u002F\u002Fgithub.com\u002Fcockroachdb\u002Fcockroach): a cloud-native, high-availability distributed SQL database\n- Truffle Security Co. – [Trufflehog](https:\u002F\u002Fgithub.com\u002Ftrufflesecurity\u002Ftrufflehog): find leaked credentials\n- NVIDIA – [container-canary](https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fcontainer-canary): a container validator\n- AWS – [eks-node-viewer](https:\u002F\u002Fgithub.com\u002Fawslabs\u002Feks-node-viewer): a tool for visualizing dynamic node usage within an EKS cluster\n- MinIO – [mc](https:\u002F\u002Fgithub.com\u002Fminio\u002Fmc): the official [MinIO](https:\u002F\u002Fmin.io) client\n- Ubuntu – [Authd](https:\u002F\u002Fgithub.com\u002Fubuntu\u002Fauthd): an authentication daemon for cloud-based identity providers\n\n### Charm stuff\n\n- [Glow](https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fglow): a markdown reader, browser, and online markdown stash\n- [Huh?](https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fhuh): an interactive prompt and form toolkit\n- [Mods](https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fmods): AI on the CLI, built for pipelines\n- [Wishlist](https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fwishlist): an SSH directory (and bastion!)\n\n### There’s so much more where that came from\n\nFor more applications built with Bubble Tea see [Charm & Friends][community].\nIs there something cool you made with Bubble Tea you want to share? [PRs][community] are\nwelcome!\n\n## Contributing\n\nSee [contributing][contribute].\n\n[contribute]: https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbletea\u002Fcontribute\n\n## Feedback\n\nWe’d love to hear your thoughts on this project. Feel free to drop us a note!\n\n- [Twitter](https:\u002F\u002Ftwitter.com\u002Fcharmcli)\n- [The Fediverse](https:\u002F\u002Fmastodon.social\u002F@charmcli)\n- [Discord](https:\u002F\u002Fcharm.sh\u002Fchat)\n\n## Acknowledgments\n\nBubble Tea is based on the paradigms of [The Elm Architecture][elm] by Evan\nCzaplicki et alia and the excellent [go-tea][gotea] by TJ Holowaychuk. It’s\ninspired by the many great [_Zeichenorientierte Benutzerschnittstellen_][zb]\nof days past.\n\n[elm]: https:\u002F\u002Fguide.elm-lang.org\u002Farchitecture\u002F\n[gotea]: https:\u002F\u002Fgithub.com\u002Ftj\u002Fgo-tea\n[zb]: https:\u002F\u002Fde.wikipedia.org\u002Fwiki\u002FZeichenorientierte_Benutzerschnittstelle\n[community]: https:\u002F\u002Fgithub.com\u002Fcharm-and-friends\u002Fcharm-in-the-wild\n\n## License\n\n[MIT](https:\u002F\u002Fgithub.com\u002Fcharmbracelet\u002Fbubbletea\u002Fraw\u002Fmain\u002FLICENSE)\n\n---\n\nPart of [Charm](https:\u002F\u002Fcharm.sh).\n\n\u003Ca href=\"https:\u002F\u002Fcharm.sh\u002F\">\u003Cimg alt=\"The Charm logo\" src=\"https:\u002F\u002Fstuff.charm.sh\u002Fcharm-banner-softy.jpg\" width=\"400\">\u003C\u002Fa>\n\nCharm热爱开源 • Charm loves open source • نحنُ نحب المصادر المفتوحة\n","Bubble Tea 是一个强大的终端用户界面（TUI）框架，基于 Go 语言和 The Elm Architecture 设计。它提供了高性能的单元格渲染器、内置的颜色降采样、声明式视图以及高保真的键盘鼠标处理等功能，并支持原生剪贴板操作。该框架适用于构建从简单到复杂的各类终端应用程序，无论是内联显示还是全窗口模式都能胜任。对于希望使用现代编程范式开发高效且功能丰富的命令行工具或应用的开发者而言，Bubble Tea 是一个理想的选择。",2,"2026-06-11 02:41:48","top_all"]