# ui (vanilla-engine 0.4.0)

> https://vanillapunch.com/docs/vanilla-engine/0.4.0/api/ui/

UI widgets. (the WorldNode line of the original src/ui)
- As in the original, most widgets are components, not nodes. Attached to a node, they use their own node (the host) as the widget.
- Widgets that create child nodes (content, scroll bars) or companion components (Mask) are attached with node_tree.add_component(node_id, ...).
  If attached with WorldNode::add_component, attach_to_tree is not called, so there is no content node and touch is not enabled.
- The original UIScrollBar is a node inheriting WorldNode. The Rust version is a UIScrollBar component attached to a single node.
- UIInputField receives key, IME and hidden web DOM input events from the engine text input queue (core/textinput.rs).
- Widgets that inherit WorldNode in the original (UIDropdown, UIDialog, UIToast, UISpinner, UIContextMenu) are also components attached to a host node.
  When attached, they set up the host and create child nodes like the original constructors. Each widget's create(node_tree, parent_id, options) takes the place of new + add_child.
- The UINode, auto layout (autolayout) and UIScene lines were also ported. (UIDocument was ported with a type name table instead of reflection)
