Pyroxenium / Basalt

A UI Framework for CC:Tweaked
MIT License
164 stars 28 forks source link

[XML] Child layouts #75

Closed thesabinelim closed 1 year ago

thesabinelim commented 1 year ago

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} />