bubbletea

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Bubbletea Documentation

Bubbletea 文档

Bubbletea is a Go framework for building terminal user interfaces based on The Elm Architecture.
Bubbletea 是一个基于 Elm 架构、用于构建终端用户界面的 Go 框架。

Key Resources

关键资源

When you need to understand Bubbletea patterns or find examples:
  1. Examples README - Overview of all available examples: https://github.com/charmbracelet/bubbletea/blob/main/examples/README.md
  2. Examples Directory - Full source code for all examples: https://github.com/charmbracelet/bubbletea/tree/main/examples
当你需要了解 Bubbletea 模式或查找示例时:
  1. 示例目录 - 所有示例的完整源代码: https://github.com/charmbracelet/bubbletea/tree/main/examples

How to Use

使用方法

  1. First, fetch the examples README to get an overview of available examples:
    WebFetch https://github.com/charmbracelet/bubbletea/blob/main/examples/README.md
  2. Once you identify a relevant example, fetch its source code from the examples directory.
  1. 首先,获取示例 README 以了解所有可用示例的概览:
    WebFetch https://github.com/charmbracelet/bubbletea/blob/main/examples/README.md
  2. 确定相关示例后,从示例目录中获取其源代码。

Common Examples to Reference

常用参考示例

  • list
    - List component with filtering
  • table
    - Table component
  • textinput
    - Text input handling
  • textarea
    - Multi-line text input
  • viewport
    - Scrollable content
  • paginator
    - Pagination
  • spinner
    - Loading spinners
  • progress
    - Progress bars
  • tabs
    - Tab navigation
  • help
    - Help text/keybindings display
  • list
    - 带过滤功能的列表组件
  • table
    - 表格组件
  • textinput
    - 文本输入处理
  • textarea
    - 多行文本输入
  • viewport
    - 可滚动内容
  • paginator
    - 分页组件
  • spinner
    - 加载动画
  • progress
    - 进度条
  • tabs
    - 标签页导航
  • help
    - 帮助文本/快捷键显示

Core Concepts

核心概念

  • Model: Application state
  • Update: Handles messages and returns updated model + commands
  • View: Renders the model to a string
  • Cmd: Side effects that produce messages
  • Msg: Events that trigger updates
  • Model:应用状态
  • Update:处理消息并返回更新后的模型 + 命令
  • View:将模型渲染为字符串
  • Cmd:产生消息的副作用
  • Msg:触发更新的事件

Related Charm Libraries

相关 Charm 库

  • Bubbles: Pre-built components (github.com/charmbracelet/bubbles)
  • Lipgloss: Styling and layout (github.com/charmbracelet/lipgloss)
  • Glamour: Markdown rendering (github.com/charmbracelet/glamour)
  • Bubbles:预构建组件(github.com/charmbracelet/bubbles)
  • Lipgloss:样式与布局(github.com/charmbracelet/lipgloss)
  • Glamour:Markdown 渲染(github.com/charmbracelet/glamour)