Skip to content

Shape Item

Renders an SVG-based vector shape on the canvas. Supports fill, stroke, and shadows.

Creating a Shape Item

tsx
const { addItem } = useStudio()

addItem('Shape', {
  x: 100,
  y: 100,
  width: 200,
  height: 200,
  itemProps: {
    svgPath: 'M 100 10 L 190 190 L 10 190 Z', // triangle
    viewBox: { x: 0, y: 0, w: 200, h: 200 },
    fill: '#7c3aed',
  },
})

Properties

All properties below are passed inside itemProps.

PropertyTypeDescription
svgPathstringSVG path data string (d attribute). Required.
viewBox{ x: number; y: number; w: number; h: number }The viewBox of the SVG the path was taken from. Required.
fillstringFill color (hex). Required.
strokestringStroke color.
strokeWidthnumberStroke thickness in pixels.
shadowEnabledbooleanEnable or disable the shadow.
shadowColorstringShadow color.
shadowBlurnumberShadow blur radius.
shadowOffsetXnumberShadow horizontal offset.
shadowOffsetYnumberShadow vertical offset.

Notes

  • The svgPath is scaled using viewBox to fit the item's width and height.
  • For complex shapes, export SVG path data from a vector editor (Figma, Illustrator, Inkscape) and use the file's viewBox values.

Released under a proprietary license.