Svg
Svg renders a vector from a viewBox and an array of paths, with uniform sizing (size, dimensions) and color
(fill, fillAll, error). Use it for logos, illustrations and any custom vector outside the icon set.Typography & Media
When to use
Usage
<Svg viewBox="0 0 100 100" paths={[{ d: 'M50 5 L95 95 L5 95 Z', fill: 'currentColor' }]} size={120} />paths: each item hasdand an optionalfill.fillAllignores every path's ownfill.fill: color of the inner<g>the paths inherit; defaults to the theme's main color.errorpaints itdanger.- Without
sizeordimensionsthe vector renders at1em × 1em.
Sizing
size renders a square and takes precedence over dimensions. dimensions sets width with either an explicit
height or a ratio that derives the height from the width.
<Svg {...logoProps} dimensions={{ width: 300, ratio: 16 / 9 }} />
<Svg {...logoProps} dimensions={{ width: '300px', height: '80px' }} />A ratio with a string width computes the height only for px values; any other unit falls back to height: auto.
When the size resolves to a number, width and height are also emitted as native <svg> attributes, so the browser
reserves the space before the CSS loads.
Accessibility
- Pass
titlefor a meaningful graphic: it renders as the SVG<title>. - For a decorative graphic, pass
aria-hidden="true"; native<svg>attributes are forwarded.
Properties
Name
Type
Default
Description
classNamestringnonedimensions{ width: stringnumber; height?: stringnumber; ratio?: number; }undefinednoneFine-grained sizing. Use when you need an aspect ratio other than 1:1 or
explicit heights. Ignored if `size` is set.
@example ```tsx
// 16:9 ratio derived from the width
<Svg dimensions={{ width: 300, ratio: 16 / 9 }} />
// explicit dimensions
<Svg dimensions={{ width: '300px', height: '80px' }} />
```
disabledbooleannoneMarks the SVG as disabled (semantic only — styling is applied by the callsite).
errorstringRecord<string, unknown>noneWhen provided, forces the error color (the palette's `danger`) across the
whole SVG. Useful for inputs in an invalid state.
fillAllstringnoneWhen set, ignores each path's individual `fill` and forces inheritance of
the parent `<g>` color — used for monochrome SVGs.
pathsanynoneArray of paths to render. Each item has `d` (path data) and an optional `fill`.
sizestringnumbernoneUniform size. When provided, renders a square (1:1 ratio) and
`dimensions` is ignored.
titlestringnoneAccessible text used in the inner `<title>`.