On September 25th, 2024, we released v2 of the Apps SDK. To learn what’s new and how to upgrade, see Migration FAQ and Migration guide.

Path

API reference for the Path type.
This version of the API is a preview. Preview APIs are unstable and may change without warning. You can't release public apps using this API until it's stable.

A path that defines the structure of a shape element.

Properties

dstringRead-only
Required

The shape of the path.

This is similar to the d attribute of an SVG's path element, with some limitations:

  • Must start with an M command.
  • Only one M command is allowed.
  • Q and T commands are not permitted.
  • The path must be closed using a Z command or matching start and end coordinates.
fillPathFillRead-only
Required

The appearance of the path's interior.

isMediaEditablebooleanRead-only
Required

This must be true.

mediaContainerobjectRead-only
Required

A media fill, if any.

setfunction
Required

Parameters

stateundefined | MediaFillState
Required

A state that creates an image fill.

typestringRead-only
Required

The type of media.

This must be "image".

imageRefImageRefRead-only
Required

A unique identifier that points to an image asset in Canva's backend.

flipXboolean
Required

If true, the image is flipped horizontally.

flipYboolean
Required

If true, the image is flipped vertically.

A state that creates a video fill.

typestringRead-only
Required

The type of media.

This must be "video".

videoRefVideoRefRead-only
Required

A unique identifier that points to a video asset in Canva's backend.

flipXboolean
Required

If true, the video is flipped horizontally.

flipYboolean
Required

If true, the video is flipped vertically.

Returns

void

refundefined | MediaFill
Required

An image that fills the interior of a media.

typestringRead-only
Required

The type of media.

This must be "image".

imageRefImageRefRead-only
Required

A unique identifier that points to an image asset in Canva's backend.

flipXboolean
Required

If true, the image is flipped horizontally.

flipYboolean
Required

If true, the image is flipped vertically.

A video that fills the interior of a media.

typestringRead-only
Required

The type of media.

This must be "video".

videoRefVideoRefRead-only
Required

A unique identifier that points to a video asset in Canva's backend.

flipXboolean
Required

If true, the video is flipped horizontally.

flipYboolean
Required

If true, the video is flipped vertically.

colorContainerobjectRead-only
Required

A color fill, if any.

setfunction
Required

Parameters

stateundefined | SolidFillState
Required
typestringRead-only
Required

The type of color.

This must be "solid".

colorstring
Required

The color of the fill. This must be a valid, six-digit hex code, prefixed with a # symbol.

  • Must be six characters long.
  • Must start with a #.
  • Must use lowercase letters.

Example

"#ff0099"
TS

Returns

void

refundefined | ColorFill
Required

A solid color that fills an interior.

typestringRead-only
Required

The type of color.

This must be "solid".

colorstring
Required

The color of the fill. This must be a valid, six-digit hex code, prefixed with a # symbol.

  • Must be six characters long.
  • Must start with a #.
  • Must use lowercase letters.

Example

"#ff0099"
TS

Represents something that's not supported by the Apps SDK.

typestringRead-only
Required

This must be "unsupported".

isMediaEditablebooleanRead-only
Required

This must be false.

mediaContainerobjectRead-only
Required

A media fill, if any. MediaFill is not editable

refundefined | MediaFill
Required

An image that fills the interior of a media.

typestringRead-only
Required

The type of media.

This must be "image".

imageRefImageRefRead-only
Required

A unique identifier that points to an image asset in Canva's backend.

flipXboolean
Required

If true, the image is flipped horizontally.

flipYboolean
Required

If true, the image is flipped vertically.

A video that fills the interior of a media.

typestringRead-only
Required

The type of media.

This must be "video".

videoRefVideoRefRead-only
Required

A unique identifier that points to a video asset in Canva's backend.

flipXboolean
Required

If true, the video is flipped horizontally.

flipYboolean
Required

If true, the video is flipped vertically.

colorContainerobjectRead-only
Required

A color fill, if any.

setfunction
Required

Parameters

stateundefined | SolidFillState
Required
typestringRead-only
Required

The type of color.

This must be "solid".

colorstring
Required

The color of the fill. This must be a valid, six-digit hex code, prefixed with a # symbol.

  • Must be six characters long.
  • Must start with a #.
  • Must use lowercase letters.

Example

"#ff0099"
TS

Returns

void

refundefined | ColorFill
Required

A solid color that fills an interior.

typestringRead-only
Required

The type of color.

This must be "solid".

colorstring
Required

The color of the fill. This must be a valid, six-digit hex code, prefixed with a # symbol.

  • Must be six characters long.
  • Must start with a #.
  • Must use lowercase letters.

Example

"#ff0099"
TS

Represents something that's not supported by the Apps SDK.

typestringRead-only
Required

This must be "unsupported".

strokeStroke | undefinedRead-only
Required

The stroke (outline) of the path, if any.

For more information, see Stroke.