Inline React Node

Inline React nodes are a powerful new way to add custom functionality to your web apps using the power of React.

Define a custom React render function using JSX and pass in its props. Dynaboard and React will take care of the rest. You are able to access any values within the WebAssembly programmatically (e.g. input1.value).

The following React Hooks are supported:

  • useState
  • useCallback
  • useRef
  • useEffect
  • useLayoutEffect

Examples

Hello World

This example will display the text "Hello, World!", and allow the user to override their name using the name prop:

return HelloWorld({ name = 'World!' }) {
return <em>Hello, {name}!</em>
}

Counter

This example will display a counter with a button that when clicked, increments the counter:

return Counter() {
const [counter, setCounter] = useState(0)
const increment = useCallback(() => {
setCounter((c) => c + 1)
}, [])
return (
<div>
<strong>Cookies:</strong> {counter}
<hr />
<button onClick={increment}>Increment</button>
</div>
)
}

Properties

Visible

PropinlineReactNode.isVisible
Typeboolean
Default{{true}}

Whether or not this node is visible.

Enabled

PropinlineReactNode.isEnabled
Typeboolean
Default{{true}}

Whether or not this node is enabled.

Tooltip

PropinlineReactNode.tooltip
Typestring
Defaultundefined

The tooltip text to display when hovered or focused over this node.

Top

PropinlineReactNode.top
Typestring
Default1

The position of the node from the top side of the grid (grid-row-start).

Left

PropinlineReactNode.left
Typestring
Default1

The position of the node from the left side of the grid (grid-column-start).

Width

PropinlineReactNode.width
Typestring
Default128px

The width of the node. When this node is in a grid layout, this should be done using unitless grid column units (specifying 4 will become grid-column-end: span 4). When this node is in a stack layout, the width must be specified using CSS units (e.g. 100px or 100%).

Min Width

PropinlineReactNode.minWidth
Typestring
Defaultnone

The minimum width of the node. When this node is in a grid layout, this property is ignored.

Max Width

PropinlineReactNode.maxWidth
Typestring
Defaultnone

The maximum width of the node. When this node is in a grid layout, this property is ignored.

Height

PropinlineReactNode.height
Typestring
Default32px

The height of the node. When this node is in a grid layout, this should be done using unitless grid row units (specifying 4 will become grid-row-end: span 4). When this node is in a stack layout, the height must be specified using CSS units (e.g. 100px or 100%).

Min Height

PropinlineReactNode.minHeight
Typestring
Defaultnone

The minimum height of the node. When this node is in a grid layout, this property is ignored.

Max Height

PropinlineReactNode.maxHeight
Typestring
Defaultnone

The minimum height of the node. When this node is in a grid layout, this property is ignored.

Overflow

PropinlineReactNode.overflow
TypeOverflow ('auto' | 'visible' | 'hidden' | 'scroll')
Defaultauto

The strategy used to handle overflow in the horizontal and vertical axes for content that is larger than its container.

Overflow X

PropinlineReactNode.overflowX
TypeOverflow ('auto' | 'visible' | 'hidden' | 'scroll')
Defaultauto

The strategy used to handle overflow in the horizontal axis for content that is larger than its container.

Overflow Y

PropinlineReactNode.overflowY
TypeOverflow ('auto' | 'visible' | 'hidden' | 'scroll')
Defaultauto

The strategy used to handle overflow in the vertical axis for content that is larger than its container.

Custom Styles

PropinlineReactNode.styles
Typestring
Defaultelement.styles { }

Custom CSS styles to be applied to the node. Use element.styles to refer to the current node.

Props

PropinlineReactNode.props
Typestring
Default{}

The props to pass into the React component. Must be an object.

Component Source

PropinlineReactNode.componentSource
Typestring
Defaultreturn function Component() { return <strong>Hello, React!</strong> }

The TypeScript source code for the React component to render. The component function should be returned explicitly using return. JSX and React Hooks are already available in scope.