created: 20230309202111093 creator: H La Vallee modified: 20230427124452601 modifier: H La Vallee tags: $:/tags/Macro meta title: ButtonListMacro type: text/vnd.tiddlywiki \define buttonlist(listTag clickTag icon) <$list filter=[tag[$listTag$]!is[system]!sort[created]]> <$fieldmangler tiddler=<>> <$button class="tc-btn-invisible" actions="""<$action-sendmessage $message="tm-add-tag" $param=$clickTag$/><$action-sendmessage $message="tm-remove-tag" $param=$listTag$/>"""> <$transclude tiddler="$icon$">x <$link to=<> text=<>/>
\end \define buttonlisttable(listTag clickTag icon) <$list filter=[tag[$listTag$]!is[system]!sort[created]]> <$fieldmangler tiddler=<>>
$clickTag$ $listTag$
<$button class="tc-btn-invisible" style="width:100%" actions="""<$action-sendmessage $message="tm-add-tag" $param=$clickTag$/><$action-sendmessage $message="tm-remove-tag" $param=$listTag$/>"""> <$transclude tiddler="$icon$">x <$link to=<> text=<>/>
\end \define buttonlist2(listTag clickTag icon clickTag2 icon2) <$list filter=[tag[$listTag$]!is[system]!sort[created]]> <$fieldmangler tiddler=<>> <$button class="tc-btn-invisible" actions="""<$action-sendmessage $message="tm-add-tag" $param=$clickTag$/><$action-sendmessage $message="tm-remove-tag" $param=$listTag$/>"""> <$transclude tiddler="$icon$">x <$link to=<> text=<>/> <$button class="tc-btn-invisible" actions="""<$action-sendmessage $message="tm-add-tag" $param=$clickTag2$/><$action-sendmessage $message="tm-remove-tag" $param=$listTag$/>"""> <$transclude tiddler="$icon2$">y
\end \define buttonlisttable2(listTag clickTag icon clickTag2 icon2) <$list filter=[tag[$listTag$]!is[system]!sort[created]]> <$fieldmangler tiddler=<>>
$clickTag$ $listTag$ $clickTag2$
<$button class="tc-btn-invisible" style="width:100%" actions="""<$action-sendmessage $message="tm-add-tag" $param=$clickTag$/><$action-sendmessage $message="tm-remove-tag" $param=$listTag$/>"""> <$transclude tiddler="$icon$">x <$link to=<> text=<>/> <$button class="tc-btn-invisible" style="width:100%" actions="""<$action-sendmessage $message="tm-add-tag" $param=$clickTag2$/><$action-sendmessage $message="tm-remove-tag" $param=$listTag$/>"""> <$transclude tiddler="$icon2$">y
\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 (called iconTiddler), 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. !!!Syntax: `<>` `<>` `<>` `<>` !!!Example/Demo (tag some tiddlers with "now"): --- !!My Todo List !!!__Now__ `<>` <> !!! __Done__ `<>` <> !!!__Pending__ `<>` <>