[XML] Child layouts #75

Merged
thesabinelim merged 2 commits from child-layouts into master 2023-05-15 01:58:29 +08:00
thesabinelim commented 2023-05-15 01:54:49 +08:00 (Migrated from github.com)

Allows loading of child layouts within another layout, which react to updates in their reactive props. Treat this as a proof of concept and just cementing the API, because the implementation will certainly change. Example:

layout.xml

<script>
  local basalt = require("basalt")
  AnotherLayout = basalt.layout("another_layout.xml")
  getText, setText = basalt.reactive("Button not clicked")
</script>

<AnotherLayout text={getText()} />
<button text="Click me">
  <onClick>
    setText("Button clicked")
  </onClick>
</button>

another_layout.xml

<label text={props.text} />
Allows loading of child layouts within another layout, which react to updates in their reactive props. Treat this as a proof of concept and just cementing the API, because the implementation will certainly change. Example: layout.xml ```xml <script> local basalt = require("basalt") AnotherLayout = basalt.layout("another_layout.xml") getText, setText = basalt.reactive("Button not clicked") </script> <AnotherLayout text={getText()} /> <button text="Click me"> <onClick> setText("Button clicked") </onClick> </button> ``` another_layout.xml ```xml <label text={props.text} /> ```
Sign in to join this conversation.
No description provided.