---
title: Layout
---
A scripted Layout which can function just like a [Node](/scripting/api-reference/interfaces/node) but
also has the ability to fit into a layout box provided via
resize. It can also be intrinsically sized allowing hosting
layouts to attempt to fit to its size by using the measure
function to report desired dimensions.
For more information, see [Layout Scripts](/scripting/protocols/layout-scripts).
## Methods
### `measure`
{/* measure: ((self: T) -> Vector) | nil */}
```lua
measure(self: T) -> Vector
```
When provided this Layout can be intrinsically sized/request
to be a specific size. This is not guaranteed as the layout
may have min/max dimensions. Resize will be called with the
granted size after being measured.
```lua
-- Measure the computed size of the layout on resize
function measure(self: MyLayout): Vector
return Vector.xy(100, 100)
end
```
### `resize`
{/* resize: (self: T, size: Vector) -> () */}
```lua
resize(self: T, size: Vector) -> ()
```
Guaranteed to be called to set initial size and also called
whenever the size changes.
```lua
-- Called when the layout resizes based on the content
-- This only applies to Layouts with a fit type of Hug
function resize(self: MyLayout, size: Vector)
print('Resize:', size)
end
```