You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I've built a tooltip component that I'm already using in my own Bubble Tea app and thought it could be a good fit for Bubbles. Would love to get feedback on the API and approach before opening a PR.
Usage
import (
"charm.land/bubbles/v2/tooltip""charm.land/lipgloss/v2"
)
tip:=tooltip.New(
tooltip.WithContent("Press Enter to continue"),
tooltip.WithPlacement(tooltip.Top),
tooltip.WithFallbackPlacements(tooltip.Bottom, tooltip.Right, tooltip.Left),
tooltip.WithOffset(1, 0),
tooltip.WithStyle(
lipgloss.NewStyle().
Padding(0, 1).
Border(lipgloss.RoundedBorder()).
Foreground(lipgloss.Color("252")),
),
)
tip.SetViewport(width, height)
tip.SetAnchor(anchorX, anchorY, anchorWidth, anchorHeight)
_=tip.Show()
// In your View(), render as an overlay on top of existing content:view=tip.Render(baseView)
Route messages through tip.Update(msg) in your update loop for delayed open/close, escape-to-dismiss, and cursor tracking.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I've built a tooltip component that I'm already using in my own Bubble Tea app and thought it could be a good fit for Bubbles. Would love to get feedback on the API and approach before opening a PR.
Usage
Route messages through tip.Update(msg) in your update loop for delayed open/close, escape-to-dismiss, and cursor tracking.
Features
Implementation
Working branch with tests: https://github.com/meszmate/bubbles/tree/feature/tooltip-component
Happy to adjust the API based on feedback!
Beta Was this translation helpful? Give feedback.
All reactions