Skip to main content

ExportSettings

Figma has three types of exports: images, SVGs and PDFs.

type ExportSettings = ExportSettingsImage | ExportSettingsSVG | ExportSettingsPDF

Common properties

contentsOnly?: boolean [readonly]

Whether only the contents of the node are exported, or any overlapping layer in the same area. Defaults to true.


useAbsoluteBounds?: boolean [readonly]

Use the full dimensions of the node regardless of whether or not it is cropped or the space around it is empty. Use this to export text nodes without cropping. Defaults to false.


suffix?: string [readonly]

Suffix appended to the file name when exporting. Defaults to empty string.


ExportSettingsImage

format: 'JPG' | 'PNG' [readonly]

The string literal representing the export format. Always check the format before reading other properties.


constraint?: ExportSettingsConstraints [readonly]

Constraint on the image size when exporting.

interface ExportSettingsConstraints {
type: "SCALE" | "WIDTH" | "HEIGHT"
value: number
}

Defaults to 100% of image size { type: "SCALE", value: 1 }.

  • "SCALE": The size of the exported image is proportional to the size of the exported layer in Figma. A value of 1 means the export is 100% of the layer size.
  • "WIDTH": The exported image is scaled to have a fixed width of value.
  • "HEIGHT": The exported image is scaled to have a fixed height of value.

ExportSettingsSVG

format: 'SVG' [readonly]

The string literal "SVG" representing the export format. Always check the format before reading other properties.


svgOutlineText?: boolean [readonly]

Whether text elements are rendered as outlines (vector paths) or as <text> elements in SVGs. Defaults to true.

Rendering text elements as outlines guarantees that the text looks exactly the same in the SVG as it does in the browser/inside Figma.

Exporting as <text> allows text to be selectable inside SVGs and generally makes the SVG easier to read. However, this relies on the browser’s rendering engine which can vary between browsers and/or operating systems. As such, visual accuracy is not guaranteed as the result could look different than in Figma.


svgIdAttribute?: boolean [readonly]

Whether to include layer names as ID attributes in the SVG. This can be useful as a way to reference particular elements, but increases the size of the SVG. SVG features that require IDs to function, such as masks and gradients, will always have IDs. Defaults to false.


svgSimplifyStroke?: boolean [readonly]

Whether to export inside and outside strokes as an approximation of the original to simplify the output. Otherwise, it uses a more precise but more bloated masking technique. This is needed because SVGs only support center strokes. Defaults to true.


ExportSettingsPDF

format: 'PDF' [readonly]

The string literal "PDF" representing the export format. Always check the format before reading other properties.