created: 20230309202111093 creator: H La Vallee modified: 20230721191954644 modifier: H La Vallee tags: $:/tags/Macro meta title: ButtonListMacro type: text/vnd.tiddlywiki \procedure buttonlist(listTag clickTag icon sort) <$let default="[!sort[created]]" plus={{{[prefix[:]then[]else[+]]}}} sortop={{{[!match[]else]}}} filterpre="[tag[<>]!is[system]] <><>"> <$wikify text=<> name=filter> <$list filter=<>> <$fieldmangler tiddler=<>> <$button class="tc-btn-invisible" actions="""<$action-sendmessage $message="tm-add-tag" $param=<>/><$action-sendmessage $message="tm-remove-tag" $param=<>/>"""> <$transclude tiddler=<>>x <$link to=<> text=<>/>
\end \procedure buttonlisttable(listTag clickTag icon sort) <$let default="[!sort[created]]" plus={{{[prefix[:]then[]else[+]]}}} sortop={{{[!match[]else]}}} filterpre="[tag[<>]!is[system]] <><>"> <$wikify text=<> name=filter> <$list filter=<>> <$fieldmangler tiddler=<>>
<> <>
<$button class="tc-btn-invisible" style="width:100%" actions="""<$action-sendmessage $message="tm-add-tag" $param=<>/><$action-sendmessage $message="tm-remove-tag" $param=<>/>"""> <$transclude tiddler=<>>x <$link to=<> text=<>/>
\end \procedure buttonlist2(listTag clickTag icon clickTag2 icon2 sort) <$let default="[!sort[created]]" plus={{{[prefix[:]then[]else[+]]}}} sortop={{{[!match[]else]}}} filterpre="[tag[<>]!is[system]] <><>"> <$wikify text=<> name=filter> <$list filter=<>> <$fieldmangler tiddler=<>> <$button class="tc-btn-invisible" actions="""<$action-sendmessage $message="tm-add-tag" $param=<>/><$action-sendmessage $message="tm-remove-tag" $param=<>/>"""> <$transclude tiddler=<>>x <$link to=<> text=<>/> <$button class="tc-btn-invisible" actions="""<$action-sendmessage $message="tm-add-tag" $param=<>/><$action-sendmessage $message="tm-remove-tag" $param=<>/>"""> <$transclude tiddler=<>>x
\end \procedure buttonlisttable2(listTag clickTag icon clickTag2 icon2 sort) <$let default="[!sort[created]]" plus={{{[prefix[:]then[]else[+]]}}} sortop={{{[!match[]else]}}} filterpre="[tag[<>]!is[system]] <><>"> <$wikify text=<> name=filter> <$list filter=<>> <$fieldmangler tiddler=<>>
<> <> <>
<$button class="tc-btn-invisible" style="width:100%" actions="""<$action-sendmessage $message="tm-add-tag" $param=<>/><$action-sendmessage $message="tm-remove-tag" $param=<>/>"""> <$transclude tiddler=<>>x <$link to=<> text=<>/> <$button class="tc-btn-invisible" style="width:100%" actions="""<$action-sendmessage $message="tm-add-tag" $param=<>/><$action-sendmessage $message="tm-remove-tag" $param=<>/>"""> <$transclude tiddler=<>>x
\end A handful of macros to list tiddlers by a tag (called listTag), with a button to replace the tag with a different one (called clickTag). An image or svg tiddler can be specified as the icon, otherwise it will just use an "x". To have the tiddlers shown in a nice table, use the `buttonlisttable` macro! If you would like to have 2 options for tags, use the `buttonlist2` or `buttonlisttable2` macros, which support another button on the right side of the text that can switch to a second tag. The last parameter (`sort`) is optional and allows for custom sort filter runs. Defaults to `[!sort[created]]`, sorting in order of creation date (newest first). > Advanced: filter run prefixes beginning with `:` can also be used on the `sort` parameter. If one is not included, the run prefix defaults to `+`. Example: `:sort:number[]` !!!Syntax: `<>` `<>` `<>` `<>` !!!Example/Demo (tag some tiddlers with "now"): --- !!My Todo List !!!__Now__ `<>` <> !!! __Done__ `<>` <> !!!__Pending__ `<>` <>