Feature Request - A General list-picker Macro

Are you wikitext savvy enough to PR this?

We need a general “list-picker macro” that takes a filter as input and lists its contents as buttons, via some template!

It ought to be easy to make “picker lists” - click a button, get a dropdown that shows the list of items. Clicking on an item triggers some action, typically set the title value of that item in a field.

I think potential components are already in the core, but integrated into specialized picker solutions:

  • $:/TagManager defines the iconEditor(not public facing)
  • $:/core/macros/colour-picker (public) defines colour-picker which features a neat grid display and a wonderful “Recent”(-ly picked) area. But it is totally specialized (including a hard coded list of colour names).
  • $:/core/macros/tag-picker (public) This seems to be the most general one
    tag-picker(actions, tagField:"tags", tiddler, tagListFilter:"[tags[]sort[]]")

(more?)

A general macro would not necessarily need to replace the macros listed above to be useful even if, I guess, that would be desirable in the longer term. It may be that some of the above implementations serve purposes that are too special for the requested general solution.

Do you agree/disagree - why?
Is it “picker list” or “list picker”? Pist licker?

3 Likes

The tag-picker is a very special macro. Super complex because of backwards compatibility concerns and integrated keyboard handling. Replacing this one, probably is a no go without a huge backlash.

But you are right. There should be a more general picker, that is easy accessible for users.

I agree one should be provided out of the box, especialy since the keyboard widget is so hard to use.

In the editor there is the link editor toolbar button, with its ctrl-L invocation that is ideal for inserting titles into the text field. This could be generalised including permitting a filter to “scope the list” even before searching, to nominate the field and if it has one entry or is a list.

  • The ability to trigger an action would allow many forms of action to be triggered on the selected title but there is an importiant set of standard actions that should be available out of the box.

I have sucessfully cloned $:/core/ui/EditorToolbar/link-dropdown to make variations on the link button.

[Edited]

Please however look more deeply at the tag-picker macro

This may seem missleading however it permits other fields to be nominated, provides the selection interface and a scope filter that need not include tags but any title, and trigger actions.

  • Once selected you have to ensure the selected titles in the field are listed.
  • A couple of strings need to be changed/configurable such as the placeholder and list title.

I may have a look at cloning $:/core/macros/tag-picker
into $:/core/macros/title-picker to get much of what you are after.

  • Keep in mind a title can be any string provided by the filter.

What other requirrments that are variations of the tag-picker would suit @twMat?

Note: I also have a tool I call a filter pill.

I think it would already help to work through the new examples. They do contain working examples to work with other field names than tags.

See: https://tiddlywiki.com/#tag-picker%20Macro%20(Examples) → Example 2 to 5 (The ones with the “Tip” icon)

1 Like

Oooh, that’s a very nice trick! Is there a way to set the default text for the empty input box so it doesn’t say “tag name”? It confuses me :sweat_smile:

Not at present, thats why I proposed reengeneering this to a tiddler or title picker idealy with the ability to override these text lables.

As a workaround you can change the $:/language/EditTemplate/Tags/Add/Placeholder tiddler to something like eg: tag / title or something similar that makes sense in your context.

image

1 Like

Perhaps “name” is a good general term?