mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-08 18:16:44 +02:00
docs(arch): icon documentation
This commit is contained in:
61
docs/config/icons.md
Normal file
61
docs/config/icons.md
Normal file
@@ -0,0 +1,61 @@
|
||||
> **Warning**
|
||||
>
|
||||
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
|
||||
>
|
||||
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/icons.md](../../packages/mermaid/src/docs/config/icons.md).
|
||||
|
||||
# SVG Icons (v???+)
|
||||
|
||||
SVG Icons can be used with supported diagrams. Alongside the icon packs included with Mermaid, 3rd party libraries can be included in the configuration to cover additional use-cases.
|
||||
|
||||
## Supported Diagrams
|
||||
|
||||
| Diagram | Usage |
|
||||
| ------------ | --------------------------------- |
|
||||
| Architecture | Icon names are surrounded by `()` |
|
||||
|
||||
## Included Icon Packs
|
||||
|
||||
| Icon Pack | Prefix |
|
||||
| ------------- | ------ |
|
||||
| default | N/A |
|
||||
| Amazon AWS | `aws:` |
|
||||
| Digital Ocean | `do:` |
|
||||
| GitHub | `gh:` |
|
||||
|
||||
### Extended AWS Icons
|
||||
|
||||
Due to the large number of icons available to represent AWS services, only the most important ones are enabled by default. For full access, add `'aws:full'` to the `iconLibraries` field when initializing mermaid.
|
||||
|
||||
## Using Custom Icon Packs
|
||||
|
||||
Custom icon packs can be used by including them in the `iconLibraries` array on mermaid initialization.
|
||||
|
||||
```js
|
||||
import sampleIconPack from 'sample-icon-pack';
|
||||
|
||||
mermaid.initialize({
|
||||
iconLibraries: [sampleIconPack, 'aws:full'],
|
||||
});
|
||||
```
|
||||
|
||||
## Creating Custom Icon Packs
|
||||
|
||||
```js
|
||||
import { createIcon } from 'mermaid';
|
||||
import type { IconLibrary, IconResolver } from 'mermaid';
|
||||
|
||||
// type IconLibrary = Record<string, IconResolver>;
|
||||
// createIcon: (icon: string, originalSize: number) => IconResolver
|
||||
const myIconLibrary: IconLibrary = {
|
||||
defaultCloudExample: createIcon(
|
||||
`<g>
|
||||
<rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>
|
||||
<path d="..." style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>
|
||||
</g>`,
|
||||
80
|
||||
)
|
||||
};
|
||||
|
||||
export default myIconLibrary
|
||||
```
|
Reference in New Issue
Block a user