2022-02-19 08:04:25 +01:00
|
|
|
---
|
2021-10-17 18:26:00 +02:00
|
|
|
title: idPrefix
|
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-12-28 21:07:45 +01:00
|
|
|
The `idPrefix` setting allows you to specify a prefix that will be used
|
|
|
|
for all IDs in the SVG output. Its default value is `fs-`.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-10-02 17:41:04 +02:00
|
|
|
## Signature
|
|
|
|
|
|
|
|
```js
|
|
|
|
const settings = {
|
|
|
|
String idPrefix='fs-'
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-08-25 16:09:31 +02:00
|
|
|
When you embed multiple SVGs on a single page, the IDs can and will conflict,
|
2022-10-02 17:41:04 +02:00
|
|
|
especially when using `xlink:href` references (such as for text on paths and
|
|
|
|
snippets).
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
This allows you to specify an ID prefix so you can sidestep ID collisions.
|
|
|
|
|
2022-10-02 17:41:04 +02:00
|
|
|
## Example
|
|
|
|
|
2021-08-25 16:09:31 +02:00
|
|
|
```js
|
2022-10-02 17:41:04 +02:00
|
|
|
import { Aaron } from "@freesewing/aaron";
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-10-02 17:41:04 +02:00
|
|
|
const pattern = new Aaron({
|
2021-08-25 16:09:31 +02:00
|
|
|
idPrefix: "something-else"
|
|
|
|
})
|
|
|
|
```
|