Skip to main content
Question

figma.createFrame not works

  • March 6, 2024
  • 1 reply
  • 192 views

RuCaUa
const table = figma.createTable(2, 3)

create error:

Uncaught (in promise) RuntimeError: table index is out of bounds

I tried a lot of example from documentation - all works fine except table createTable. Need help

all file for tests:

console.clear()
figma.showUI(__html__) // Update the canvas dimensions here
figma.ui.onmessage = async (msg) => {
    console.log('creating');
    await figma.loadFontAsync({ family: "Inter", style: "Regular" })
    console.log('creating2');
    const frameWidth = 800
    const frameHeight = 600
    const frame = figma.createFrame()
    frame.resizeWithoutConstraints(frameWidth, frameHeight)

    // Center the frame in our current viewport so we can see it.
    frame.x = figma.viewport.center.x - frameWidth / 2;
    frame.y = figma.viewport.center.y - frameHeight / 2;

    // Border for the chart
    const border = figma.createRectangle()
    frame.appendChild(border)
    border.resizeWithoutConstraints(frameWidth, frameHeight)
    border.strokeAlign = 'INSIDE'
    border.strokeWeight = 3
    border.fills = []
    border.strokes = [{ type: 'SOLID', color: {r: 0, g: 0, b: 0} }]
    border.constraints = {horizontal: 'STRETCH', vertical: 'STRETCH'}


    console.log('creating3');
    // Create a table with 2 rows and 3 columns
    const table = figma.createTable(2, 3)
    console.log('creating4');
    
    // Sets characters for the table cells:
    // A B C
    // 1 2 3
    table.cellAt(0, 0).text.characters = 'A'
    console.log('creating5');
    table.cellAt(0, 1).text.characters = 'B'
    table.cellAt(0, 2).text.characters = 'C'
    table.cellAt(1, 0).text.characters = '1'
    table.cellAt(1, 1).text.characters = '2'
    table.cellAt(1, 2).text.characters = '3'
    console.log('creating6');
    frame.appendChild(table);
    figma.closePlugin()
}

1 reply

ksn
Figmate
  • Community Support
  • 1611 replies
  • March 8, 2024

@RuCaUa I checked in with our tech quality team, and theyโ€™d like you to file a ticket for further help with this.

Please fill out this form here, and someone will get back to you: https://help.figma.com/hc/en-us/requests/new?ticket_form_id=360001744374


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings