# ShapeContainerMixin.createStroke
Adds a stroke to this container

{/* Do not edit this file. It is automatically generated by API Documenter. */}

## ShapeContainerMixin.createStroke() method

Adds a stroke to this container

**Signature:**

```typescript
createStroke(opts: StrokeOptions): Stroke;
```

## Parameters

<table>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        opts
      </td>

      <td>
        [StrokeOptions](../../types/stroke-options)
      </td>

      <td>
        The stroke options
      </td>
    </tr>
  </tbody>
</table>

**Returns:**

[Stroke](../stroke)

The newly created stroke

## Example

```ts
// Add a solid black stroke
layer.createStroke({
  fill: { type: "SOLID", color: { r: 0, g: 0, b: 0 } },
  width: 2,
});

// Add a gradient stroke
layer.createStroke({
  fill: {
    type: "GRADIENT_LINEAR",
    stops: [
      { color: { r: 255, g: 0, b: 0 }, offset: 0, opacity: 1 },
      { color: { r: 0, g: 0, b: 255 }, offset: 1, opacity: 1 },
    ],
  },
  width: 5,
});
```
