Skip to content

Commit

Permalink
chore(docs): spinner + bubble tea README copyedits
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Dec 6, 2023
1 parent c605de3 commit c72cf18
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ Themes can take advantage of the full range of

[lipgloss]: https://github.com/charmbracelet/lipgloss

## Spinner
## Bonus: Spinner

Spinners come built in to `huh` for loading actions. It's useful to indicate
loading while completing an action after a form is submitted.
`huh?` ships with a standalone spinner package. Its useful for indicating
background activity after a form is submitted.

<img alt="Spinner while making a burger" width="600" src="https://vhs.charm.sh/vhs-5uVCseHk9F5C4MdtZdwhIc.gif">

Expand Down Expand Up @@ -296,6 +296,7 @@ fmt.Println("Order up!")
go makeBurger()

err := spinner.New().
Type(spinner.Line).
Title("Making your burger...").
Context(ctx).
Run()
Expand All @@ -307,20 +308,20 @@ fmt.Println("Order up!")
</tr>
</table>

## What about [Bubble Tea][tea]?
For more on Spinners see the [spinner examples](./spinner/examples) and
[the spinner docs](https://pkg.go.dev/github.com/charmbracelet/huh@main/spinner).

Huh is an abstraction built on Bubble Tea to make forms easier to code and
implement. You can use `huh` to replace Bubble Tea if you only need to gather
input from the user via a form.
## What about in Bubble Tea?

For more complex use cases, however, you can embed `huh` forms within Bubble Tea
applications to add forms to your applications.
`huh?` also has first-class support for [Bubble Tea][tea] and can be easily
integrated into a larger Bubble Tea application. At it’s core, a `huh.Form` is
simply a `tea.Model`.

<img alt="Bubbletea + Huh?" width="174" src="https://stuff.charm.sh/huh/bubbletea-huh.png">

```go
type Model struct {
// embed form in parent model, use as bubble.
// A huh.Form is really just a tea.Model.
form *huh.Form
}

Expand Down Expand Up @@ -370,8 +371,8 @@ func (m Model) View() string {

<img alt="Bubble Tea embedded form example" width="800" src="https://vhs.charm.sh/vhs-3wGaB7EUKWmojeaHpARMUv.gif">

See [the Bubble Tea example][example] for how to embed `huh` forms in [Bubble
Tea][tea] applications for more advanced use cases.
For more info in using `huh?` in Bubble Tea applications see [the full Bubble
Tea example][example].

[tea]: https://github.com/charmbracelet/bubbletea
[bubbles]: https://github.com/charmbracelet/bubbles
Expand Down

0 comments on commit c72cf18

Please sign in to comment.