bubbles icon indicating copy to clipboard operation
bubbles copied to clipboard

List: Expose setting of FilterValue and triggering filtering programmatically

Open toadle opened this issue 3 years ago • 2 comments

Hey guys, when using list to show and filter a list of items it would be handy to be able to not only set items programmatically, but also set the FilterValue and triggering filtering programmatically.

Currently we have:

// FilterValue returns the current value of the filter.
func (m Model) FilterValue() string {
	return m.FilterInput.Value()
}

so the FilterValue is directly tied to the FilterInput . I could theoretically hand everything down to the FilterInput, but that would be very tedious, when I have an external separate TextInput which might set the filter.

Especially, when the filterInput sets this:

filterInput.Prompt = "Filter: " - so there is no way to customize this.

So my wishlist would be:

  • [ ] Add a SetFilterValue-func
  • [ ] Add a SetLiveFilteringEnabled-func which determines if the list is automatically filtered via FilterValue
  • [ ] Add a Filter-func that actually triggers filtering via FilterValue

Thanks for the awesome work!

toadle avatar Mar 28 '22 20:03 toadle

(Related: #85)

meowgorithm avatar Mar 28 '22 21:03 meowgorithm

Looks like https://github.com/charmbracelet/bubbles/issues/344 is also related.

decentral1se avatar Apr 12 '23 13:04 decentral1se