Thanks, A lot to both of you. I think I will go with Eric's method though because I prefer to build my own library of tools
On Wednesday, 21 October 2020 at 09:56:24 UTC-5 Eric Shulman wrote: > On Tuesday, October 20, 2020 at 1:22:12 PM UTC-7, Game Dungeon wrote: >> >> I wish to emulate the drop-down arrow in the table of content for my own >> use, but I'm having trouble breaking down the table of contents code. Can >> anyone help me break it down? >> BTW: My use case is having a title with text that I can open and close >> under it So it takes up less of my screen. >> > > see "Accordion or Slider" in https://tiddlywiki.com/#RevealWidget > > Try this: > > First, create a tiddler, "ToggleTiddler", tagged with $:/tags/Macro, > containing: > \define toggle(title) > <$vars toggle_id=<<qualify "$:/state/toggle/$title$">>> > <$reveal state=<<toggle_id>> type="nomatch" text="show"> > <$button class="tc-btn-invisible" set=<<toggle_id>> setTo="show"> > <$text text="""$title$"""/> {{$:/core/images/right-arrow}} > </$button> > </$reveal> > <$reveal state=<<toggle_id>> type="match" text="show"> > <$button class="tc-btn-invisible" set=<<toggle_id>> setTo="hide"> > <$text text="""$title$"""/> {{$:/core/images/down-arrow}} > </$button> > <$transclude tiddler="""$title$""" mode="block"/> > </$reveal> > \end > > Then, in any other tiddler, you can use it like this: > <<toggle "NameOfTiddler">> > > Notes: > * The $vars constructs a "state tiddler" title that incorporates the > target tiddler title. The state tiddler keeps track of whether the content > is shown or hidden. > * <<qualify "...">> is used to ensure that each use of the toggle macro is > unique > * The first $reveal displays a $button when the target tiddler content is > not being shown > * The $button then sets the state tiddler's value to "show" > * The $button uses class="tc-btn-invisible" so that it appears as normal > text (i.e., without the usual button appearance) > * The $button label displays the title of the target tiddler followed by > the right-arrow image > * The second $reveal does the opposite of the first $reveal (i.e., > displays a $button that sets the state value to "hide", and uses the > down-arrow image) > * The second $reveal also $transcludes the target tiddler content > > References: > https://tiddlywiki.com/#RevealWidget > https://tiddlywiki.com/#qualify%20Macro > > enjoy, > -e > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/4696e568-60bb-4c53-a839-dde8b7c408een%40googlegroups.com.

