Skip to main content

resize

Resizes the node. If the node contains children with constraints, it applies those constraints during resizing. If the parent has auto-layout, causes the parent to be resized.

Signature

resize(width: number, height: number): void

Parameters

width

New width of the node. Must be >= 0.01

height

New height of the node. Must be >= 0.01, except for LineNode which must always be given a height of exactly 0.

Remarks

Since this function applies constraints recursively (when there are multiple levels of nested frames with constraints), calls to this function could be expensive. Use resizeWithoutConstraints if you don't need to apply constraints.

caution

⚠️ If this node is a text node with a missing font or contains a text node with a missing font, the text node will be resized but the text will not re-layout until the next time the text node is opened on a machine that has the font. This can cause the text node to re-layout immediately and be surprising to your user. Consider checking if the document figma.hasMissingFont before using this function.