diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js index 08b446962..46a590f2e 100644 --- a/docs/.vitepress/config.js +++ b/docs/.vitepress/config.js @@ -94,6 +94,7 @@ export default ({ mode }) => { collapsed: false, items: [ { text: 'ui-button', link: '/nodes/widgets/ui-button' }, + { text: 'ui-button-group', link: '/nodes/widgets/ui-button-group' }, { text: 'ui-control', link: '/nodes/widgets/ui-control' }, { text: 'ui-chart', link: '/nodes/widgets/ui-chart' }, { text: 'ui-dropdown', link: '/nodes/widgets/ui-dropdown' }, diff --git a/docs/nodes/widgets/ui-button-group.md b/docs/nodes/widgets/ui-button-group.md new file mode 100644 index 000000000..264af2dd1 --- /dev/null +++ b/docs/nodes/widgets/ui-button-group.md @@ -0,0 +1,37 @@ +--- +props: + Group: Defines which group of the UI Dashboard this widget will render in. + Size: Controls the width of the button with respect to the parent group. Maximum value is the width of the group. + Label: The text shown within the button. + Appearance: Specify whether the shape of the widget should be rectangular or have rounded corners. + Use theme colors: Specify whether the theme colors should be used. If not active, custom colors can be specified for each option separately. + Options: Specify which options need to be displayed. Each option can specify a label, icon, value and color. + Topic: The text that needs to be send in the msg.topic field. + Passthrough: Specify whether input messages should be passed through as output messages. +controls: + enabled: + example: true | false + description: Allow control over whether or not the button is clickable. +dynamic: + Class: + payload: msg.class + structure: ["String"] +--- + + + +# Button `ui-button-grup` + +Adds a set of buttons that act as a multi-state switch to your dashboard. When an individual button is clicked, it will become active and all other buttons in the group will become inactive, with the newly selected value being emitted from the node in Node-RED. + +The selected option can be set by sending a `msg.payload` with the value of the button to be selected. + +## Properties + + + +## Examples + +![Examples of a Button Group](/images/node-examples/ui-button-group.png "Example of a Button Group"){data-zoomable} +*Example of some rendered button groups in a Dashboard.* diff --git a/docs/public/images/node-examples/ui-button-group.png b/docs/public/images/node-examples/ui-button-group.png new file mode 100644 index 000000000..277655cc3 Binary files /dev/null and b/docs/public/images/node-examples/ui-button-group.png differ diff --git a/nodes/widgets/locales/en-US/ui_button_group.html b/nodes/widgets/locales/en-US/ui_button_group.html new file mode 100644 index 000000000..c3757f66f --- /dev/null +++ b/nodes/widgets/locales/en-US/ui_button_group.html @@ -0,0 +1,26 @@ + + \ No newline at end of file diff --git a/nodes/widgets/locales/en-US/ui_button_group.json b/nodes/widgets/locales/en-US/ui_button_group.json new file mode 100644 index 000000000..1424d25d1 --- /dev/null +++ b/nodes/widgets/locales/en-US/ui_button_group.json @@ -0,0 +1,14 @@ +{ + "ui-button-group": { + "label": { + "group": "Group", + "size": "Size", + "icon": "Icon", + "label": "Label", + "colors": "Colors", + "options": "Options", + "appearance": "Appearance", + "tcolors": "Use theme colors" + } + } +} \ No newline at end of file diff --git a/nodes/widgets/ui_button_group.html b/nodes/widgets/ui_button_group.html index 76332678c..f6a2a0a41 100644 --- a/nodes/widgets/ui_button_group.html +++ b/nodes/widgets/ui_button_group.html @@ -196,7 +196,7 @@ node.options.push({ label, icon, value, valueType, color }) }) - } + } }) @@ -206,32 +206,32 @@
- +
- +
- +
- +
- + - Use theme colors +
- + All Values must be unique.
@@ -247,76 +247,4 @@
- - - \ No newline at end of file diff --git a/ui/src/widgets/ui-button-group/UIButtonGroup.vue b/ui/src/widgets/ui-button-group/UIButtonGroup.vue index d918dc906..c1042276f 100644 --- a/ui/src/widgets/ui-button-group/UIButtonGroup.vue +++ b/ui/src/widgets/ui-button-group/UIButtonGroup.vue @@ -113,6 +113,10 @@ export default { background-color: rgb(var(--v-theme-group-background)); } +.nrdb-ui-button-group-wrapper .v-btn--variant-elevated { + --v-activated-opacity: 0; +} + .nrdb-ui-button-group-wrapper .icon-only .v-btn__prepend { margin-inline: 0; }