Skip to content

Commit

Permalink
Add ui-template documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
joepavitt committed Aug 8, 2023
1 parent 2b89c87 commit 8a7742c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default {
{ text: 'ui-dropdown', link: '/nodes/widgets/ui-dropdown' },
{ text: 'ui-slider', link: '/nodes/widgets/ui-slider' },
{ text: 'ui-switch', link: '/nodes/widgets/ui-switch' },
{ text: 'ui-template', link: '/nodes/widgets/ui-template' },
{ text: 'ui-text', link: '/nodes/widgets/ui-text' },
{ text: 'ui-text-input', link: '/nodes/widgets/ui-text-input' },
{ text: 'ui-markdown', link: '/nodes/widgets/ui-markdown' },
Expand Down
Binary file added docs/assets/images/node-examples/ui-template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions docs/nodes/widgets/ui-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
props:
Group: Defines which group of the UI Dashboard this widget will render in.
Template: Controls the width of the button with respect to the parent group. Maximum value is the width of the group.
---

<script setup>
</script>

# Text `ui-template`

Provide custom HTML (including any [Vuetify components](https://vuetifyjs.com/en/components/all/)) to render in the Dashboard.

The template also has access to two built-in functions:

- `send` - Outputs a message (defined by the input to this function call) from this node in the Node-RED flow.
- `submit` - Send a `FormData` object when attached to a `<form>` element. The created object will consnist of the `name` attributes for each form element, corresponding to their respective `value` attributes.

_Note: Currently restricted to custom HTML only, but there are plans to add `<style>` and `<script>` editors in the future too (track [here](https://github.com/flowforge/flowforge-nr-dashboard/issues/115))._

## Properties

<PropsTable/>

## Example

![Examples of UI Template](../../assets/images/node-examples/ui-template.png "Examples of UI Template"){data-zoomable}
*Examples of variants of ui-template, one with a functional form, and another showing use of random Vuetify components.*
1 change: 0 additions & 1 deletion ui/src/widgets/ui-text/UIText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default {
flex-direction: row;
gap: 2px;
}
.nrdb-ui-text-label {}
.nrdb-ui-text-value {
font-weight: 600;
}
Expand Down

0 comments on commit 8a7742c

Please sign in to comment.