This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

RevealWidget

127.0.0.125 janvier 2015 à 18h06

Introduction

The reveal widget hides or shows its content depending upon the value of a state tiddler. The type of the widget determines the condition for the content being displayed:

  • type=match: the content is displayed if the state tiddler matches a specified value
  • type=nomatch: the content is displayed if the state tiddler doesn't match a specified value
  • type=popup: the content is displayed as a popup as described in the PopupMechanism

Content and Attributes

The content of the <$reveal> widget is displayed according to the rules given above.

AttributeDescription
stateThe title of the tiddler containing the state
typeThe type of matching performed: match, nomatch or popup
textThe text to match when the type is match and nomatch
positionThe position used for the popup when the type is popup. Can be left, above, aboveright, right, belowleft or below
defaultDefault value to use when the state tiddler is missing
animateSet to "yes" to animate opening and closure (defaults to "no")
retainSet to "yes" to force the content to be retained even when hidden (defaults to "no")

Retaining the content when hidden can give poor performance since the hidden content requires refresh processing even though it is not displayed. On the other hand, the content can be revealed much more quickly. Note that setting animate="yes" will also force retain="yes".

Examples

Simple content reveal

Here's a simple example of showing and hiding content with buttons:

<$button set="$:/state/SampleReveal1" setTo="show">Show me</$button>
<$button set="$:/state/SampleReveal1" setTo="hide">Hide me</$button>

<$reveal type="match" state="$:/state/SampleReveal1" text="show">

! This is the revealed content
And this is some text

</$reveal>

Affichera ceci :

"Slider"

A slider appears as a single button that can be used to toggle the display of the contained content.

<$reveal type="nomatch" state="$:/state/SampleReveal2" text="show" animate="yes">

<$button set="$:/state/SampleReveal2" setTo="show">Show me</$button>

</$reveal>
<$reveal type="match" state="$:/state/SampleReveal2" text="show" animate="yes">

<$button set="$:/state/SampleReveal2" setTo="hide">Hide me</$button>

! This is the revealed content
And this is some text

</$reveal>

Affichera ceci :

Popup

Here is a simple example of a popup built with the RevealWidget:

<$button popup="$:/SamplePopupState">Pop me up!</$button>

<$reveal type="popup" state="$:/SamplePopupState">
<div class="tc-drop-down">

! This is the popup
And this is some text

</div>
</$reveal>

Affichera ceci :