2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
title: Snippets
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-12-14 21:24:28 -08:00
|
|
|
A Snippet is a reusable bit of markup that draws graphic elements on patterns.
|
|
|
|
Snippets are provided by [plugins](/reference/plugins) and are implemented as
|
2023-01-10 19:05:50 +01:00
|
|
|
[`defs` elements](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs)
|
2022-12-14 21:24:28 -08:00
|
|
|
in the rendered SVG document.
|
|
|
|
|
|
|
|
## Signature
|
|
|
|
|
|
|
|
To place a Snippet at a given point:
|
|
|
|
```js
|
|
|
|
const snippet = new Snippet(String 'snippet name', Point anchor)
|
|
|
|
```
|
|
|
|
|
|
|
|
<Related>
|
|
|
|
See the [Snippet API](/reference/api/snippet)
|
|
|
|
for more information about how to use Snippets in code.
|
|
|
|
|
|
|
|
See [Using Attributes](/howtos/code/attributes)
|
|
|
|
for information about custom Attributes that can be used with Snippets.
|
|
|
|
</Related>
|
|
|
|
|
|
|
|
## List of snippets
|
|
|
|
|
|
|
|
Below are all the different snippets we maintain.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
<ReadMore list />
|