theme/fluent/tabview.go
Functions
func PaintTabBar
func (p TabViewPainter) PaintTabBar(canvas widget.Canvas, ps tabview.PaintState) {
if ps.Bounds.IsEmpty() {
return
}
colors := ps.ColorScheme
if colors == (tabview.TabColorScheme{}) {
colors = p.resolveColors()
}
// Tab bar background.
canvas.DrawRect(ps.Bounds, colors.Background)
// Draw each tab.
for i := range ps.Tabs {
ts := &ps.Tabs[i]
flPaintTab(canvas, ts, colors)
}
// Selected indicator.
if ps.SelectedIdx >= 0 && ps.SelectedIdx < len(ps.Tabs) {
selected := &ps.Tabs[ps.SelectedIdx]
flPaintTabIndicator(canvas, selected.Bounds, ps.Position, colors.Indicator)
}
// Focus ring.
if ps.Focused {
innerBounds := ps.Bounds.Expand(-flTabFocusRingInset)
canvas.StrokeRoundRect(innerBounds, colors.FocusRing, flTabFocusRadius, flTabFocusRingStroke)
}
}
Structs
type TabViewPainter struct
TabViewPainter renders tab bars using Fluent Design tokens.
Fluent tabs have a subtle selected indicator and clean typography.
If Theme is nil, TabViewPainter falls back to the default Fluent Blue palette.
type TabViewPainter struct {
Theme *Theme // nil uses default Fluent Blue fallback
}
PaintTabBar renders a tab bar according to Fluent Design specifications.