# createPolygonPath

```ts
import { createPolygonPath, Path } from "@pibbl/core";
```

[`PolygonPathOptions`](/reference/types/elements-components/#polygonpathoptions) is accepted by `createPolygonPath(options): Path2D`, which creates a fresh
closed path from finite numeric pairs, with optional numeric corner radii.
Short lists are safe empty geometry; no render state or events are owned.

```tsx
<Path
  style={{
    d: createPolygonPath({
      coords: [
        [0, 80],
        [50, 0],
        [100, 80],
      ],
    }),
    fill: "#f59e0b",
  }}
/>
```

See the [Polygon live example](/playground/#/examples/drawing/polygon).

## API details from source

<span id="api-createPolygonPath"></span>

Creates a Canvas Path2D for polygon geometry from validated options.

```ts
createPolygonPath: (options: Readonly<PolygonPathOptions>) => Path2D
```

Related API: [createPolygonPath](/reference/functions/create-polygon-path/), [PolygonPathOptions](/reference/types/elements-components/#polygonpathoptions).

### Parameters

- **`options`** — Ordered polygon vertices and corner rounding settings. See
[PolygonPathOptions](/reference/types/elements-components/#polygonpathoptions) .

### Returns

A native Canvas path containing the polygon.

### See also

[PolygonPathOptions](/reference/types/elements-components/#polygonpathoptions)

[View source — packages/core/src/lib/geometry/polygon.ts:25](/source/packages/core/src/lib/geometry/polygon-ts/#L25)

## Implementation guidance for agents

Read the [Drawing, layout, and effects companion](/agents/topics/layout/) for ownership, adaptation, failure modes, and verification. [Agent start](/agents/) provides the version-selection workflow.

## Complete minimal examples

- [Polygon path factories](/minimal-examples/paths/polygon-factories/): Create rounded rectangles and polygons alongside regular and star shapes. [Plain source](/minimal/paths/polygon-factories.ts)
## Documentation version

Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.
