mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-17 23:34:50 +00:00
80256b4dab
* Add string '.htm' to 'Saving with TiddlyIE' * Change external links to match locale with wiki language * Add instructions for use to 'Saving on Android' * Change string in 'task' * Change instructions for use in 'Saving on iPad/iPhone' * Add newline to 'TiddlyDesktop Releases' * Remove caption from 'Serving TW5 from Android' * Change link to external in tiddlers which tagged 'Editions' * Remove string 'index.html' from 'Some of the things you can do with TiddlyWiki' * Change link 'TiddlyWiki Groups' to 'Forums' in tiddlers which tagged 'Community' * Remove CamelCase link 'TiddlyWiki' from tiddlers tagged 'Community' * Change string 'done' to 'Upgrade' in 'UpgradeMechanism' * Change buttons to images in 'How to export tiddlers' * Add images about buttons to tiddlers * Add quotation mark to text 'edit' in 'Signing the Contributor License Agreement' * Rename 'UsingSVG' to 'Using SVG' * Change link 'TypedBlockWikiText' to 'Typed Blocks in WikiText' in 'Using SVG' * Add tiddler 'Using Stamp' * Add 'rel="noopener noreferrer"' to external links * Add description about 'rel="noreferrer"' to 'HTML in WikiText' * Add link of prerelease version about translators edition, and how to translate on Node.js, in 'Translate TiddlyWiki into your language' * Change string 'dropdown' to 'tab' in 'Installing a plugin from the plugin library' * Add download button to 'Empty Edition'
53 lines
2.7 KiB
Plaintext
53 lines
2.7 KiB
Plaintext
caption: button
|
|
created: 20131024141900000
|
|
modified: 20160429175044822
|
|
tags: Widgets
|
|
title: ButtonWidget
|
|
type: text/vnd.tiddlywiki
|
|
|
|
! Introduction
|
|
|
|
The button widget displays an HTML `<button>` element that can perform a combination of optional actions when clicked:
|
|
|
|
* Executing any ActionWidgets passed in the `actions` attribute
|
|
* Executing any ActionWidgets that are immediate children of the button widget
|
|
* Execute any integrated actions:
|
|
** Navigate to a specified tiddler
|
|
** Dispatch a user defined [[widget message|Messages]]
|
|
** Trigger a user defined [[popup|PopupMechanism]]
|
|
** Assign new text to a specified tiddler
|
|
|
|
The integrated actions are provided as a shortcut for invoking common actions. The same functionality is available via ActionWidgets, with the exception of the support for highlighting selected popups.
|
|
|
|
! Content and Attributes
|
|
|
|
The content of the `<$button>` widget is displayed within the button.
|
|
|
|
|!Attribute |!Description |
|
|
|actions |A string containing ActionWidgets to be triggered when the key combination is detected |
|
|
|to |The title of the tiddler to navigate to |
|
|
|message |The name of the [[widget message|Messages]] to send when the button is clicked |
|
|
|param |The optional parameter to the message |
|
|
|set |A TextReference to which a new value will be assigned |
|
|
|setTo |The new value to assign to the TextReference identified in the `set` attribute |
|
|
|popup |Title of a state tiddler for a popup that is toggled when the button is clicked |
|
|
|aria-label |Optional [[Accessibility]] label |
|
|
|tooltip |Optional tooltip |
|
|
|class |An optional CSS class name to be assigned to the HTML element|
|
|
|style |An optional CSS style attribute to be assigned to the HTML element |
|
|
|selectedClass |An optional additional CSS class to be assigned if the popup is triggered or the tiddler specified in `set` already has the value specified in `setTo` |
|
|
|tag |An optional html tag to use instead of the default "button" |
|
|
|default |Default value if `set` tiddler is missing for testing against `setTo` to determine `selectedClass` |
|
|
|
|
''Note:'' In almost all other cases where a TextReference is used as a widget attribute, it will be placed between curly brackets, to [[transclude|Transclusion in WikiText]] the value currently stored there. However, when we use a TextReference as the value of a button widget's `set` attribute, we are referencing //the storage location itself//, rather than the value stored there, so we do ''not'' use curly brackets there. //Example:// we could code a button widget that sets the `caption` field of TiddlerA to be the same as that of TiddlerB as:
|
|
|
|
```
|
|
<$button set="TiddlerA!!caption" setTo={{TiddlerB!!caption}} >
|
|
|
|
Press me!
|
|
|
|
</$button>
|
|
```
|
|
|
|
''Tip:'' Set ''class'' to `tc-btn-invisible tc-tiddlylink` to have a button look like an internal link.
|