Skip to content

Commit

Permalink
feat: add Title option for lists
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbunni committed Jul 18, 2024
1 parent 87dd58d commit 4e3b8d3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
// List represents a list of items that can be displayed. Lists can contain
// lists as items, they will be rendered as nested (sub)lists.
//
// In fact, lists can contain anything as items, like lipgloss.Table or lipgloss.Tree.
// In fact, lists can contain anything as items, like lipgloss.Table.
type List struct{ tree *tree.Tree }

// New returns a new list with the given items.
Expand Down Expand Up @@ -80,6 +80,12 @@ type Items tree.Children
// })
type StyleFunc func(items Items, index int) lipgloss.Style

// Title sets the title of the list.
func (l *List) Title(title string) *List {
l.tree.Root(title)
return l
}

// Hidden returns whether this list is hidden.
func (l *List) Hidden() bool {
return l.tree.Hidden()
Expand Down

0 comments on commit 4e3b8d3

Please sign in to comment.