mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
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:
parent
ddb88cfdf8
commit
a769139136
5 changed files with 125 additions and 29 deletions
|
|
@ -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
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue