Jump to content

Template:Show: Difference between revisions

From Insurer Brain
Content deleted Content added
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
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><span class="mw-collapsible {{#ifeq:{{lc:{{{state|collapsed}}}}}|expanded||mw-collapsed}}" id="mw-customcollapsible-{{{id|1}}}" style="display:inline; {{{style|}}}">
<span class="mw-collapsible-content" style="display:inline;">
data-expandtext="{{{expandtext|more ▾}}}"
{{{text|}}}<span class="mw-customtoggle-{{{id|1}}}" style="cursor:pointer; color:#0645ad; margin-left:0.5em; vertical-align:baseline; display:inline;">{{{collapsetext|less ▴}}}</span>
data-collapsetext="{{{collapsetext|less ▴}}}"
</span>
style="{{#ifeq:{{{inline|}}}|yes|display:inline;}}{{#ifeq:{{{compact|}}}|yes|display:inline-block; vertical-align:top;}} {{{style|}}}">
</span><span class="mw-customtoggle-{{{id|1}}} mw-collapsible {{#ifeq:{{lc:{{{state|collapsed}}}}}|expanded|mw-collapsed|}}" id="mw-customcollapsible-{{{id|1}}}-btn" style="cursor:pointer; color:#0645ad; margin-left:0.5em; vertical-align:baseline; display:inline-block;">{{{expandtext|more ▾}}}</span></includeonly><noinclude>
<{{#ifeq:{{{inline|}}}|yes|span|div}} class="mw-collapsible-content" style="{{#ifeq:{{{inline|}}}|yes|display:inline;}}">

{{{text|}}}</{{#ifeq:{{{inline|}}}|yes|span|div}}>
</{{#ifeq:{{{inline|}}}|yes|span|div}}></includeonly><noinclude>
== Usage ==
== Usage ==
To ensure the buttons "glue" to the end of the text, you must provide a unique '''id''' if using this more than once on a single page.
Standard block usage (floats toggle to the far right):
<pre>
{{show
|text=The primary driver for the acquisition was the target's proprietary AI technology.
}}
</pre>


== Compact Usage ==
This version prevents the "jump" and keeps the link next to the text.
<pre>
<pre>
{{show
{{show
|id=bio1
|compact=yes
|compact=yes
|text=This text is short and the button stays close and aligned.
|text=This is a very long text that will span multiple lines. When it expands, the "less" button will stay right here at the end.
}}
}}
</pre>
</pre>


== Parameters ==
== Parameters ==
* '''id''': (Required if multiple on one page) A unique name like "1", "2", "bio", etc.
* '''text''': The content to be hidden/shown.
* '''expandtext''': The text for the "show" link (Defaults to "more ▾").
* '''text''': The content.
* '''collapsetext''': The text for the "hide" link (Defaults to "less ").
* '''expandtext''': Defaults to "more ".
* '''inline''': Set to "yes" to use span tags.
* '''collapsetext''': Defaults to "less ▴".
* '''compact''': Set to "yes" to keep the toggle link next to the text and fix the "push down" alignment issue.
* '''state''': Set to "expanded" to show by default.
* '''state''': Set to "expanded" to have the text visible on page load.
* '''style''': Pass additional CSS styles directly.

== Required CSS ==
Add this to your [[MediaWiki:Common.css]] to ensure the "more" link doesn't float away:
<pre>
.mw-compact-toggle .mw-collapsible-toggle {
float: none !important;
display: inline-block !important;
margin-left: 0.5em;
vertical-align: top !important;
}
</pre>
</noinclude>
</noinclude>

Revision as of 01:26, 20 December 2025


Usage

To ensure the buttons "glue" to the end of the text, you must provide a unique id if using this more than once on a single page.

{{show
|id=bio1
|compact=yes
|text=This is a very long text that will span multiple lines. When it expands, the "less" button will stay right here at the end.
}}

Parameters

  • id: (Required if multiple on one page) A unique name like "1", "2", "bio", etc.
  • text: The content.
  • expandtext: Defaults to "more ▾".
  • collapsetext: Defaults to "less ▴".
  • state: Set to "expanded" to show by default.