MDL-74150 tool_componentlibrary: Add title attribute to core/toggle

This commit is contained in:
Carlos Castillo
2022-05-16 11:43:55 -05:00
parent 5e5e12e063
commit 3236a41c3a
2 changed files with 6 additions and 1 deletions
@@ -19,6 +19,7 @@ The parameters for the template context are:
* checked: If the initial status is checked.
* disabled: If toggle input is disabled.
* dataattributes: Array of name/value elements added as data-attributes.
* title: Title text.
* label: Label text.
* labelclasses: Any extra classes added to the label container.
@@ -35,6 +36,7 @@ Checked toggle and with "sr-only" label.
"name": "action",
"value": "toggle-status"
}],
"title": "Toggle Enabled",
"label": "Enable/disable status",
"labelclasses": "sr-only"
}
@@ -52,6 +54,7 @@ Disabled toggle with extra classes.
"name": "action",
"value": "toggle-status"
}],
"title": "Toggle Disabled",
"label": "Enable/disable status"
}
{{< /mustache >}}
@@ -68,6 +71,7 @@ The parameters that you can define are:
* disabled
* labelmarkup: Label element code block.
* Should include *class="custom-control-label"*.
* title: Title text.
* label: Label text.
* labelclasses: Any extra classes added to the label container.
+2 -1
View File
@@ -28,6 +28,7 @@
"name": "action",
"value": "toggle-reality"
}],
"title": "Title example",
"label": "Enable/disable reality",
"labelclasses": "sr-only"
}
@@ -41,7 +42,7 @@
{{#disabled}}disabled{{/disabled}}
{{/attributes}}>
{{$labelmarkup}}
<label class="custom-control-label" for="{{$id}}{{id}}{{/id}}">
<label class="custom-control-label" for="{{$id}}{{id}}{{/id}}" {{#title}}data-toggle="tooltip" data-placement="top" title="{{title}}"{{/title}}>
<span class="{{$labelclasses}}{{labelclasses}}{{/labelclasses}}">{{$label}}{{label}}{{/label}}</span>
</label>
{{/labelmarkup}}