createShapeWithText
info
This API is only available in FigJam
Creates a new shape with text.
Signature
createShapeWithText(): ShapeWithTextNode
Remarks
By default, the new node has a width and height of 208, and is parented under figma.currentPage
.
Create a rounded rectangle shape with text
(async () => {
const shape = figma.createShapeWithText()
shape.shapeType = 'ROUNDED_RECTANGLE'
// Load the font before setting characters
await figma.loadFontAsync(shape.text.fontName)
shape.text.characters = 'Hello world!'
})()