Path
Build paths with commands such as move, line, quad, cubic, arc, and close. Suitable for customizing pointers, curves and combined outlines, and setting fill rules and strokes.
Example
function main() {
return (
<Path
commands={[
{ op: 'move', x: 10, y: 80 },
{ op: 'line', x: 60, y: 10 },
{ op: 'line', x: 110, y: 80 },
{ op: 'close' },
]}
background={$env.accent}
stroke={$env.foreground}
lineWidth={2}
/>
);
}
Usage
- commands execute in order: move starts a subpath; line/quad/cubic/arc add segments; close closes it. An arc command’s x/y is its center. evenOdd can cut holes in nested contours. Returning to the first point is not equivalent to close.
- contentAnimation transitions text, images or structured data rather than scalar properties. interpolate needs compatible structure: matching Polyline point count/closed state, Path command sequence or chart samples. Structural changes update immediately.
Properties
commandsReadonlyArray<PathCommand>Local path commands in points. An empty array draws nothing.
[{op: "move", x: 0, y: 0}, {op: "line", x: 100, y: 80}]fillRule?"nonZero" | "evenOdd"Path fill rule: nonZero or evenOdd.
"nonZero"background?PaintFill paint for the path interior. Transparent by default.
"clear"stroke?PaintStroke paint; accepts a color or gradient. Use clear to hide the stroke.
HDR($env.dark ? "white" : "black")lineWidth?numberStroke thickness in points; 0 draws no stroke.
2lineCap?"round" | "butt" | "square"Stroke end shape: butt stops at the endpoint, square extends it, round rounds it.
"round"lineJoin?"round" | "miter" | "bevel"Shape of joined stroke segments: miter, round or bevel.
"round"dash?number[]Alternating painted and empty lengths in points; an empty array makes a solid stroke.
[]dashPhase?numberOffset along the dash pattern, in points.
0trimStart?numberVisible path interval from trimStart to trimEnd, within 0–1. Circle/Ellipse/Arc use angles instead.
0trimEnd?numberVisible path interval from trimStart to trimEnd, within 0–1. Circle/Ellipse/Arc use angles instead.
1contentAnimation?ContentAnimationOptional content transition. Interpolate requires the same command count and operation sequence; otherwise updates immediately.
{type: "interpolate", duration: 0.25}Common properties
width?number | "auto" | "fill"Width in points, auto sizing or parent fill.
"fill"height?number | "auto" | "fill"Height in points, auto sizing or parent fill.
"fill"x?numberVisual offset in points: x moves right, y moves down. Does not change layout space.
0y?numberVisual offset in points: x moves right, y moves down. Does not change layout space.
0transform?ViewTransformTransform the whole View without changing layout. Translation uses points; rotation/skew use degrees; scale 1 is unchanged; anchors use 0–1.
{rotation: 0}opacity?numberOpacity of the whole View: 0 is transparent, 1 is opaque.
1clipped?booleanClip drawing that extends beyond the View bounds.
falseclip?"rectangle" | "ellipse"Clipping shape: rectangle or ellipse. Material also accepts false to disable clipping.
"rectangle"mask?View | nullAlpha mask View. Centered without affecting layout; null disables masking.
<Circle width="fill" height="fill" background="white"/>zIndex?numberDrawing order among siblings; larger values appear in front.
0blur?numberBlur radius in points; 0 disables blur.
4innerShadow?DrawingEffectEffect color, opacity, blur radius and x/y offset. Distances are in points.
{color: HDR("black"), opacity: 0.5, radius: 4, x: 0, y: 2}glow?DrawingEffectEffect color, opacity, blur radius and x/y offset. Distances are in points.
{color: HDR("cyan"), radius: 8, opacity: 0.8}shadowColor?ColorColor of the outer shadow.
HDR("black")shadowOpacity?numberOuter shadow opacity from 0 to 1; 0 hides it.
0shadowRadius?numberOuter shadow blur radius in points.
4shadowX?numberOuter shadow offset in points: x right, y down.
0shadowY?numberOuter shadow offset in points: x right, y down.
2animations?Animation[]Animate a supported property when it changes. duration/delay use seconds; from/to set endpoints; repeat and autoreverse control repetition; wrap sets a periodic range.
[{property: "opacity", duration: 0.25, curve: "easeInOut"}]key?string | numberStable identity among siblings.
Practical example
function main() {
return (
<Path
width={140}
height={100}
fillRule="evenOdd"
background={$env.accent}
commands={[
{ op: 'move', x: 0, y: 0 },
{ op: 'line', x: 140, y: 0 },
{ op: 'line', x: 140, y: 100 },
{ op: 'line', x: 0, y: 100 },
{ op: 'close' },
{ op: 'move', x: 35, y: 25 },
{ op: 'line', x: 105, y: 25 },
{ op: 'line', x: 105, y: 75 },
{ op: 'line', x: 35, y: 75 },
{ op: 'close' },
]}
/>
);
}
Animation
widthheightxyopacitybackgroundblurshadowColorshadowOpacityshadowRadiusshadowXshadowYtrimStarttrimEnddashPhasestrokelineWidthtransform.translateXtransform.translateYtransform.scaleXtransform.scaleYtransform.rotationtransform.skewXtransform.skewYtransform.anchorXtransform.anchorYWhen omitted
The table lists omission behavior verified against implementation. Property examples are copyable syntax, not defaults. Pass explicit values for a fixed result; contextual dimensions and theme colors are not fixed constants.
| Properties | When omitted |
|---|---|
commands | [] |
fillRule | "nonZero" |
background | "clear" |
lineWidth | 2 |
stroke | HDR($env.dark ? 'white' : 'black') |