Update property nesting

Deeper nested properties guaranteed to be processed after shallower
nested properties.

Also added strict mode checks for duplicate nested properties.
This commit is contained in:
Aaron Smith 2023-08-14 11:42:16 +01:00
parent ddb88cfdf8
commit a769139136
5 changed files with 125 additions and 29 deletions

View file

@ -1,4 +1,4 @@
# Property Groups
# Nested Properties
Often when creating components from existing components, you can find yourself
repetitively passing through properties such as size or position.
@ -99,3 +99,22 @@ List {
}
}
```
Deeper nested properties are guaranteed to be set after shallower nested
properties, this can be used to create overridable default properties.
```lua
local function CenteredList(props: Children & Layout)
return List {
Layout = {
props.Layout,
-- can be overriden by `props.Layout`
AnchorPoint = Vector2.new(0.5, 0),
Position = UDim2.fromScale(0.5, 0)
},
Children = props.Children
}
end
```