Svg Reference
How to render an SVG?
To render a SVG, you can:
- use one of the following components in a markdown page:
- import a svg file in a programmatic page
Options
Optimization
The svg are optimized
The following svg configuration are applied:
- svgo preset-default
- removeViewBox and removeDimensions: ie keep or create viewBox and deletes the dimensions (width and height)
- removeTitle, removeDesc, removeDoctype
Sizing
Note that the optimization deletes the dimensions (width and height) so that the author or the parent container can control them via
- tailwind class
- or attribute.
Example:
- Via tailwind class
Import
On file import, the SVG are transformed as React Component with SvgR
Example:
- With the below import statement, OpenAiIcon is a React component optimized
- or from a file