Skip to content

feat: reactive ui context - #728

Open
makspll wants to merge 4 commits into
agent/reactive-ui-stylefrom
agent/reactive-ui-context
Open

makspll wants to merge 4 commits into
agent/reactive-ui-stylefrom
agent/reactive-ui-context

Conversation

@makspll

@makspll makspll commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Context: a value provided to a subtree and read by any component below, instead of passed through the props of every component in between.

local Theme = ui.create_context({ accent = "#ffcc00" })          -- the default value

ui.provide(Theme, { accent = "#00ccff" }, { ui.element(Inventory) })

local Slot = ui.component("Slot", function(props)
    local theme = ui.use_context(Theme)                          -- nearest provided value, or the default
    ...
end)
  • provide is a node whose children (and what they mount later: components, show and list regions) see the value
  • what is provided is remembered where each component and region is mounted (a shared linked list, no copy), so re-renders and regions running later see the same values
  • the value is read when a component renders: provide a signal for a value which changes

Stacked on #727. Tested in Lua and Rune (a component inside a show region mounted after the first render, and after a reload).

@semanticdiff-com

semanticdiff-com Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

ProjectBevy Scripting
Branchagent/reactive-ui-context
Testbedlinux-gha

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

🐰 View full continuous benchmarking report in Bencher

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant