paragraphSpacing
The vertical distance between paragraphs. Setting this property requires the font to be loaded.
Supported on:
Signature
paragraphSpacing: number | figma.mixed
Remarks
Working with Paragraph Level Fields
const text = figma.createText()
await figma.loadFontAsync({ family: 'Inter', style: 'Regular' })
// Create text with two paragraphs, separated by \n
text.characters = "hello figma, welcome to my plugin!\nI love the Figma Plugin API!"
text.resize(120, 30)
text.textAutoResize = 'HEIGHT'
// Apply 20px paragraph spacing - all paragraphs covered by the provided text range will be
// modified, and remaining paragraphs will be untouched.
text.setRangeParagraphSpacing(0, 1, 20)
// text.paragraphSpacing = Symbol(figma.mixed)
// text.getStyledTextSegments(['paragraphSpacing']) =
// [
// {
// "characters": "hello figma, welcome to my plugin!\n",
// "start": 0,
// "end": 35,
// "paragraphSpacing": 20
// },
// {
// "characters": "I love the Figma Plugin API!",
// "start": 35,
// "end": 63,
// "paragraphSpacing": 0
// }
// ]
text.setRangeTextWrapStyle(38, 39, 'BALANCE')
// text.textWrapStyle = Symbol(figma.mixed)
// text.getStyledTextSegments(['textWrapStyle']) =
// [
// {
// "characters": "hello figma, welcome to my plugin!\n",
// "start": 0,
// "end": 35,
// "textWrapStyle": "AUTO"
// },
// {
// "characters": "I love the Figma Plugin API!",
// "start": 35,
// "end": 63,
// "textWrapStyle": "BALANCE"
// }
// ]