Jump to content

Template:Show: Difference between revisions

From Insurer Brain
Content deleted Content added
No edit summary
Tag: Manual revert
No edit summary
Line 1: Line 1:
<includeonly><{{#ifeq:{{{inline|}}}|yes|span|div}} class="mw-collapsible {{#ifeq:{{lc:{{{state|collapsed}}}}}|expanded||mw-collapsed}} {{#ifeq:{{{compact|}}}|yes|mw-compact-toggle|}}"
<includeonly><{{#ifeq:{{{inline|}}}|yes|span|div}} class="mw-collapsible {{#ifeq:{{lc:{{{state|collapsed}}}}}|expanded||mw-collapsed}}"
data-expandtext="{{{expandtext|more ▾}}}"
data-expandtext="{{{expandtext|more ▾}}}"
data-collapsetext="{{{collapsetext|less ▴}}}"
data-collapsetext="{{{collapsetext|less ▴}}}"
style="{{#ifeq:{{{inline|}}}|yes|display:inline;}}{{#ifeq:{{{compact|}}}|yes|display:inline-block; vertical-align:baseline;}} {{{style|}}}">
style="{{#ifeq:{{{inline|}}}|yes|display:inline;}}">
<{{#ifeq:{{{inline|}}}|yes|span|div}} class="mw-collapsible-content" style="{{#ifeq:{{{inline|}}}|yes|display:inline;}}">
<{{#ifeq:{{{inline|}}}|yes|span|div}} class="mw-collapsible-content" style="{{#ifeq:{{{inline|}}}|yes|display:inline;}}">
{{{text|}}}</{{#ifeq:{{{inline|}}}|yes|span|div}}>
{{{text|}}}</{{#ifeq:{{{inline|}}}|yes|span|div}}>
</{{#ifeq:{{{inline|}}}|yes|span|div}}></includeonly><noinclude>
</{{#ifeq:{{{inline|}}}|yes|span|div}}></includeonly><noinclude>
== Usage ==
== Usage ==
Standard block usage (floats toggle to the far right):
<pre>
<pre>
{{Expand summary
{{show
|text=Your long summary here.
|text=The primary driver for the acquisition was the target's proprietary AI technology.
}}
}}
</pre>
</pre>


== Compact Usage ==
== Inline Usage ==
This prevents the "more" link from floating to the right margin, keeping it next to the text and aligned to the baseline:
<pre>
<pre>
{{Expand summary
{{show
|compact=yes
|inline=yes
|text=Your continuation text here.
|text=This text is short and the button stays close and aligned.
}}
}}
</pre>

== Custom Labels ==
To change the "more" and "less" buttons:
<pre>
{{show
|expandtext=Read Bio
|collapsetext=Close
|text=John Doe has been the CEO since 2010...
}}
</pre>

== Inline Usage ==
To use within a sentence (uses span tags):
<pre>
The company reported a record revenue {{show|inline=yes|text=of $1.2B in Q4 2025.|expandtext=(more)}}
</pre>

== Parameters ==
* '''text''': The content to be hidden/shown.
* '''expandtext''': The text for the "show" link (Defaults to "more ▾").
* '''collapsetext''': The text for the "hide" link (Defaults to "less ▴").
* '''inline''': Set to "yes" to use span tags (remains part of the paragraph).
* '''compact''': Set to "yes" to keep the toggle link next to the text instead of right-aligned and fix baseline vertical alignment.
* '''state''': Set to "expanded" to have the text visible on page load.
* '''style''': Pass additional CSS styles directly.

== Required CSS ==
For the '''compact''' mode to look its best, add this to your [[MediaWiki:Common.css]]:
<pre>
.mw-compact-toggle .mw-collapsible-toggle {
float: none !important;
display: inline !important;
margin-left: 0.5em;
vertical-align: baseline !important;
}
</pre>
</pre>
</noinclude>
</noinclude>

Revision as of 17:51, 21 December 2025

Usage

{{Expand summary
|text=Your long summary here.
}}

Inline Usage

{{Expand summary
|inline=yes
|text=Your continuation text here.
}}