Create dividers with Plugin API – figma.createDivider()?

I have built a simple plugin for my organization to generate our best practice Figma file boilerplate. I would love to be able to take advantage of the new page dividers feature, but if I use the API to edit the name of the page to something like ‘—’ it doesn’t turn into a divider like it would from the UI.

Feature requests

  1. Add ability to create dividers — Figma.createDivider()?
  2. Turn pages to divider if name is changed to “—” or similar like in UI

CleanShot 2024-07-01 at 11.18.45

3 Likes

same situation

@Mikael_Ahlstrom trying to do same goal plugin, could you tell me please how you replace first page, precreated when you open new file?

@Andrey_Cretsu I don’t think you can with the API. I’m just keeping the Page 1 to be deleted manually.

@Andrey_Cretsu you actually can rename existing pages. Here’s my entire TypeScript file with renaming.

Pastebin

@Mikael_Ahlstrom I’m sure you can, have you seen this plugin?

https://www.figma.com/community/plugin/1052545092839185617

@Mik thank you, I’ll check your code

@Mikael_Ahlstrom I receive an error with your code about “includes”

Would be nice to have this als available from the api :grin:.

Perhaps @Gleb could bring this up to the Figma team :grimacing:

I don’t work for Figma

You can bring this to the team yourself by posting on discord.

My bad i thought you were part of Figma :sweat_smile: . I’ll will be going in search of Figma’s discord

@Andrey_Cretsu I don’t mean to sound rude, but if your code doesn’t still work, I suggest you google the error :sweat_smile: The problem is written in the end of that error message and solution is quite literally the first google result. Just add latest ECMAScript to your tsconfig.json and you’re good.

1 Like

Same, naming the layer with ----- or **** just puts the names like this. I hope they will add this option to the plugin API

Everyone at Figma is very busy with AI now so it’s not guaranteed anyone would fix anything :laughing::laughing:

Same issue here.
It’s funny how everyone creates the same plugin in their organisations. :sweat_smile: (maybe an idea for another feature request haha).

1 Like