Template:Show: Difference between revisions
Appearance
Content deleted Content added
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
| Line 1: | Line 1: | ||
<includeonly>< |
<includeonly><span class="mw-collapsible {{#ifeq:{{lc:{{{state|collapsed}}}}}|expanded||mw-collapsed}}" id="mw-customcollapsible-{{{id|1}}}" style="display:inline; {{{style|}}}"> |
||
| ⚫ | |||
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 ▴}}}" |
|||
| ⚫ | |||
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> |
|||
| ⚫ | |||
{{{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. |
|||
}} |
|||
| ⚫ | |||
== 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 |
|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. |
|||
* ''' |
* '''text''': The content. |
||
* ''' |
* '''expandtext''': Defaults to "more ▾". |
||
* ''' |
* '''collapsetext''': Defaults to "less ▴". |
||
* ''' |
* '''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.