mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-04 23:39:57 +00:00
62bb8affa4
* Add data attribute support to button widget * Fix typo * Refactor ready for making mechanism more generic * Apply more generic implementation to multiplate widgets * Refactor to use existing widget.assignAttributes() method * Fix typo * Clarify docs * Update docs * Update select widget to support style.* attributes * Remove obsolete comment * Fixes refresh issues for checkbox and links widgets for data attributes (#7846) * fix: refresh issues with checkbox and links widgets * fix: indenting * Feat: add support for data attributes to Draggable and Droppable widgets (#7845) * Docs clarification * docs: add style and data attributes to Draggable and Droppable widget docs (#7850) * Refactors Select widget to directly create DOM node (#7848) * fix: refactored SelectWidget to directly create DOM nodes * fix: refactored SelectWidget to directly create DOM nodes * fix: improve refresh handling for select widget * Fixes issues in the PR "Button widget data attributes" (#7852) * fix: fixed ordered attributes handling and improved tests to catch event attributes * fix: clean up code from testing * fix: more tests and refactoring * fix: use lowercase when checking for event attribute prefix * fix: use lowercase when checking for event attribute prefix * fix: changed comment wording * fix: minor refactoring * refactor: for brevity --------- Co-authored-by: Saq Imtiaz <saq.imtiaz@gmail.com>
46 lines
2.7 KiB
Plaintext
46 lines
2.7 KiB
Plaintext
caption: radio
|
|
created: 20131212195353929
|
|
modified: 20231113093304323
|
|
tags: Widgets TriggeringWidgets
|
|
title: RadioWidget
|
|
type: text/vnd.tiddlywiki
|
|
|
|
! Introduction
|
|
|
|
The radio widget displays an HTML `<input type="radio">` that reflects whether a given tiddler field has a specified value. Selecting the radio button sets to the tiddler field to the value.
|
|
|
|
! Content and Attributes
|
|
|
|
The content of the `<$radio>` widget is displayed within an HTML `<label>` element also containing the radio button. This means that clicking on the content will have the same effect as clicking on the button itself.
|
|
|
|
|!Attribute |!Description |
|
|
|tiddler |Title of the tiddler to manipulate (defaults to the [[current tiddler|Current Tiddler]]) |
|
|
|field |The field of the //tiddler// bound to the radio button |
|
|
|index|<<.from-version "5.1.14">> The index of the //tiddler// being [[DataTiddler|DataTiddlers]] bound to the radio button (takes precedence over //field//) |
|
|
|default |<<.from-version "5.2.0">> The default value to be used for matching if the tiddler, field or index are missing |
|
|
|value |The value for the //field// or //index// of the //tiddler// |
|
|
|class |The CSS classes assigned to the label around the radio button <<.from-version "5.1.14">> `tc-radio` is always applied by default, as well as `tc-radio-selected` when selected |
|
|
|actions|<<.from-version "5.1.23">> Optional string containing ActionWidgets to be triggered when the value changes. <br>The variable: ''actionValue'' is available for the actions |
|
|
|disabled|<<.from-version "5.1.23">> Optional. Set to "yes" to disable the radio input. Defaults to "no" |
|
|
|data-* |<<.from-version "5.3.2">> Optional [[data attributes|https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes]] to be assigned to the `<input>` HTML element |
|
|
|style.* |<<.from-version "5.3.2">> Optional [[CSS properties|https://developer.mozilla.org/en-US/docs/Web/CSS/Reference]] to be assigned to the `<input>` HTML element |
|
|
|
|
!! Field Mode
|
|
|
|
This example uses the radio widget to change the `modifier` field of this tiddler:
|
|
|
|
<<wikitext-example-without-html """<$radio field="modifier" value="JoeBloggs"> Joe Bloggs</$radio>
|
|
<$radio field="modifier" value="JaneBloggs"> Jane Bloggs</$radio>""">>
|
|
|
|
!! Index Mode
|
|
|
|
Using the radio widget in index mode requires the //index// attribute to specify the name of the index of a [[DataTiddler|DataTiddlers]] to which the specified //value// is assigned.
|
|
|
|
This example sets the `Tree Frog` index in the tiddler AnimalColours:
|
|
|
|
<$macrocall $name="wikitext-example-without-html" src="""<$tiddler tiddler="AnimalColours">
|
|
<$radio index="Tree Frog" value="green"> green</$radio>
|
|
<$radio index="Tree Frog" value="brown"> brown</$radio>
|
|
</$tiddler>"""/>
|
|
|
|
{{RadioWidget Example}} |