diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbtoggle.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbtoggle.directive.js index 89772e735e..a7bdd4b741 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbtoggle.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbtoggle.directive.js @@ -11,12 +11,19 @@
+
+
+
+ label-position="right"
+ hide-icons="true">
@@ -46,9 +53,11 @@
@param {boolean} checked Set to true or false to toggle the switch.
@param {callback} onClick The function which should be called when the toggle is clicked.
+@param {string=} showLabels Set to true or false to show a "On" or "Off" label next to the switch.
@param {string=} labelOn Set a custom label for when the switched is turned on. It will default to "On".
@param {string=} labelOff Set a custom label for when the switched is turned off. It will default to "Off".
@param {string=} labelPosition Sets the label position to the left or right of the switch. It will default to "left" ("left", "right").
+@param {string=} hideIcons Set to true or false to hide the icons on the switch.
**/
@@ -107,7 +116,9 @@
onClick: "&",
labelOn: "@?",
labelOff: "@?",
- labelPosition: "@?"
+ labelPosition: "@?",
+ showLabels: "@?",
+ hideIcons: "@?"
},
link: link
};
diff --git a/src/Umbraco.Web.UI.Client/src/less/components/buttons/umb-toggle.less b/src/Umbraco.Web.UI.Client/src/less/components/buttons/umb-toggle.less
index 9e5960dd5f..2156f75d00 100644
--- a/src/Umbraco.Web.UI.Client/src/less/components/buttons/umb-toggle.less
+++ b/src/Umbraco.Web.UI.Client/src/less/components/buttons/umb-toggle.less
@@ -3,6 +3,35 @@
align-items: center;
}
+.umb-toggle__handler {
+ display: inline-block;
+ width: 24px;
+ height: 24px;
+ background-color: @white;
+ border-radius: 50px;
+ transform: rotate(-45deg);
+}
+
+.umb-toggle__toggle {
+ cursor: pointer;
+ display: inline-block;
+ width: 48px;
+ height: 24px;
+ background: @gray-8;
+ border-radius: 90px;
+ position: relative;
+}
+
+.umb-toggle--checked .umb-toggle__toggle {
+ background-color: @green;
+}
+
+.umb-toggle--checked .umb-toggle__handler {
+ transform: translate3d(24px, 0, 0) rotate(0);
+}
+
+/* Labels */
+
.umb-toggle__label {
font-size: 12px;
color: @gray-2;
@@ -16,29 +45,21 @@
margin-left: 8px;
}
-.umb-toggle__handler {
- display: inline-block;
- width: 20px;
- height: 20px;
- background-color: @white;
- border-radius: 50px;
- transform: rotate(-45deg);
+/* Icons */
+
+.umb-toggle__icon {
+ position: absolute;
+ top: 3px;
+ text-decoration: none;
+ transition: all 0.2s ease;
}
-.umb-toggle__toggle {
- cursor: pointer;
- display: inline-block;
- width: 40px;
- height: 20px;
- background: @gray-8;
- border-radius: 90px;
- transition: background-color 0.2s ease;
+.umb-toggle__icon--left {
+ left: 7px;
+ color: @white;
}
-.umb-toggle--checked .umb-toggle__toggle {
- background-color: @green;
-}
-
-.umb-toggle--checked .umb-toggle__handler {
- transform: translate3d(21px, 0, 0) rotate(0);
-}
+.umb-toggle__icon--right {
+ right: 7px;
+ color: @gray-5;
+}
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/buttons/umb-toggle.html b/src/Umbraco.Web.UI.Client/src/views/components/buttons/umb-toggle.html
index 9d00813b6a..b0ce345ba6 100644
--- a/src/Umbraco.Web.UI.Client/src/views/components/buttons/umb-toggle.html
+++ b/src/Umbraco.Web.UI.Client/src/views/components/buttons/umb-toggle.html
@@ -1,15 +1,17 @@
-
+
{{ displayLabelOff }}
{{ displayLabelOn }}
+
+
-
+
{{ displayLabelOff }}
{{ displayLabelOn }}