Skip to content

Path ​

SVG path rendering.

Props ​

PropTypeRequiredDefaultDescription
dstringYes—SVG path data
widthnumberYes—Layout width (px)
heightnumberYes—Layout height (px)
fillstring—Fill color
strokestring—Stroke color
strokeWidthnumber—Stroke width
strokeScaling"transform" | "canvas""transform"Stroke width space. "canvas" keeps a solid stroke stable in canvas space under supported transforms
fillRule"nonzero" | "evenodd"—Fill rule for complex paths
strokeLinecap"butt" | "round" | "square"—Stroke line cap
strokeLinejoin"miter" | "round" | "bevel"—Stroke line join
strokeDasharraystring—Stroke dash pattern (e.g. "5,5")
strokeMiterlimitnumber—Stroke miter limit
opacitynumber—Opacity (0–1)
zIndexnumber—Sibling-local paint order (integer; higher paints later)
metaRecord<string, string>—Metadata emitted as data-boundsvg-meta-* attributes and into the layered manifest (max 16 keys, [a-z][a-z0-9-]{0,31} keys, 256-char values)
transformTransform2D—Static post-layout paint transform
animateAnimationSpec—Declarative opacity/transform track; see Animation

WARNING

Path coordinates in d are interpreted as local coordinates and translated to the layout box origin at render time. They are not auto-scaled or auto-clipped to fit the layout box — paths may visually overflow if coordinates exceed the width/height dimensions.

To clip overflow, wrap the Path in a container with overflow="clip".

INFO

transform is applied after the local path coordinates are positioned into the node's layout box.

INFO

Set strokeScaling="canvas" to keep a solid Path stroke at its authored canvas-space width under ancestor translation, rotation, and uniform scale. Animated SVG uses vector-effect: non-scaling-stroke; static SVG and raster formats use a deterministic fallback sampled at timeMs. The format-specific render option scale remains an output-resolution multiplier. Dashed strokes, non-uniform scale, and axis reflection fail explicitly rather than being approximated.

Path paint, including edge strokes, can extend beyond its width / height layout box. An ancestor with overflow="clip" clips that paint to its own rectangle or rounded rectangle in animated SVG and static/raster output.

Keeping paint inside a box ​

To retain clipping at the Path's layout dimensions, wrap it in a container of the same size. Add borderRadius to the container for a rounded clip:

tsx
<Box width={40} height={40} overflow="clip">
  <Path width={40} height={40} d="M0 0L120 0L120 40Z" fill="red" />
</Box>

Treat the wrapper as the original layout item: move positioning and offsets, margin, flex/grid item props (including alignSelf), zIndex, layer, transform, and animate from the Path to the wrapper. Keep the Path's local geometry and paint props on the Path. This keeps the clip in the same transformed or animated coordinate system as the paint. A clipped wrapper is atomic in layered output; assign the layer to the wrapper.

Layout and inspection bounds still describe the 40×40 layout box. Hit-test candidates use separate conservative Path geometry bounds, including stroke, so visible paint outside the layout box can receive pointer events. Explicit rectangular and rounded ancestor clips exclude both the clipped node and its descendants from hits outside the clip. Browser and React interaction also check the Path's painted fill/stroke, so holes fall through to nodes underneath. Core hit testing remains conservative inside those bounds. See Choosing an API for the interaction APIs' precision.

Flex Item ​

PropTypeDefaultDescription
flexGrownumber0Flex grow factor
flexShrinknumber1Flex shrink factor
flexBasisnumber | "auto""auto"Flex basis
alignSelf"auto" | "start" | "center" | "end" | "stretch""auto"Self alignment

Grid Item ​

PropTypeDescription
gridColumnstringGrid column placement (e.g. "1 / 3")
gridRowstringGrid row placement (e.g. "1 / 2")

Positioning ​

PropTypeDefaultDescription
position"relative" | "absolute""relative"Positioning mode
topnumber—Top offset in px
rightnumber—Right offset in px
bottomnumber—Bottom offset in px
leftnumber—Left offset in px

Box Model ​

PropTypeDescription
marginnumber | [number, number, number, number]Margin (uniform or [top, right, bottom, left])

Event / Identity ​

PropTypeDescription
onClickstringClick handler reference
onDoubleClickstringDouble-click handler reference
onContextMenustringContext menu handler reference
onPointerMovestringPointer move handler reference
onPointerEnterstringPointer enter handler reference
onPointerLeavestringPointer leave handler reference
idstringStable NodeId for hit-testing
layerstringLayer id for Layered Export

All 21 event handler props are supported. See Event Handlers for the full list.

Example ​

tsx
<Canvas width={240} height={140} background="#ffffff">
  <Flex
    width={240}
    height={140}
    padding={16}
    justifyContent="center"
    alignItems="center"
  >
    <Path
      d="M10 80 Q 95 10 180 80"
      width={200}
      height={100}
      fill="none"
      stroke="#3b82f6"
      strokeWidth={3}
    />
  </Flex>
</Canvas>
path-bezier example
Generated SVG
xml
<svg xmlns="http://www.w3.org/2000/svg" data-boundsvg-node-id="auto:0" viewBox="0 0 240 140" width="240" height="140">
  <rect x="0" y="0" width="240" height="140" fill="#ffffff"/>
  <g data-boundsvg-node-id="auto:0.0">
    <g data-boundsvg-node-id="auto:0.0.0">
      <svg data-boundsvg-node-id="auto:0.0.0" x="20" y="20" width="200" height="100" overflow="visible">
        <path d="M10 80 Q 95 10 180 80" fill="none" stroke="#3b82f6" stroke-width="3"/>
      </svg>
    </g>
  </g>
</svg>