Components
SVG Wrapper for SVG elements
<SVG> is a wrapper around the standard SVG element, allowing you to easily include SVG graphics in your Marigold application. It supports all standard SVG attributes and can be styled using Marigold's design tokens.
The <SVG> component is a simple wrapper around the native SVG element.
The appearance of a component can be customized using the variant and size props. These props adjust the visual style and dimensions of the component, available values are based on the active theme.
Variant: noneSize: noneThe selected theme does not has any options for"variant" and "size".
Property Type Description variant-The available variants of this component. size-The available sizes of this component.
You should use the <SVG> component when you want to include SVG graphics in your Marigold application.
Use it to display icons, illustrations, or any other SVG-based graphics. Inside the <SVG> component, you can include any valid SVG content, such as <path>, <circle>, <rect>, etc.
To modify the color, adjust the color prop using a fitting design token from Marigold.
Preview Code
import { Center, Inline } from '@marigold/components'; import { SVG } from '@marigold/system'; export default () => ( <Center> <Inline space={4}> <SVG size={32} color="info-muted-accent"> <path d="M19.2 3H4.8C3.81 3 3.009 3.81 3.009 4.8L3 21L6.6 17.4H19.2C20.19 17.4 21 16.59 21 15.6V4.8C21 3.81 20.19 3 19.2 3ZM12.9 13.8H11.1V12H12.9V13.8ZM12.9 10.2001H11.1V6.60008H12.9V10.2001Z"></path> </SVG> <SVG size={32} color="success-muted-accent"> <path d="M19.2917 2.625H4.70833C3.5625 2.625 2.625 3.5625 2.625 4.70833V19.2917C2.625 20.4375 3.5625 21.375 4.70833 21.375H19.2917C20.4375 21.375 21.375 20.4375 21.375 19.2917V4.70833C21.375 3.5625 20.4375 2.625 19.2917 2.625ZM9.91667 17.2083L4.70833 12.2003L6.16667 10.7981L9.91667 14.4038L17.8333 6.79167L19.2917 8.19391L9.91667 17.2083Z"></path> </SVG> <SVG size={32} color="warning-muted-accent"> <path d="M2.25 20.3097H21.75L12 3.46875L2.25 20.3097ZM12.8864 17.2606H11.1136V15.4879H12.8864V17.2606ZM12.8864 13.7151H11.1136V10.1697H12.8864V13.7151Z"></path> </SVG> <SVG size={32} color="destructive-muted-accent"> <path d="M14.9531 5H17.9062V6.75H6.09375V5H9.04688L9.89062 4.125H14.1094L14.9531 5ZM8.625 19.875C7.69688 19.875 6.9375 19.0875 6.9375 18.125V7.62502H17.0625V18.125C17.0625 19.0875 16.3031 19.875 15.375 19.875H8.625Z"></path> </SVG> </Inline> </Center> );
You can pass any valid SVG attributes to the <SVG> component. This includes attributes like viewBox, width, height and more. The component will pass these attributes directly to the underlying SVG element, allowing you to customize the appearance and behavior of the SVG as needed.
Here is a list of more explanations for some common SVG attributes: SVG attribute reference
Did you know? You can explore, test, and customize props live in Marigold's storybook. Watch the effects they have in real-time!
accentHeight?number | string
accumulate?"sum" | "none"
additive?"replace" | "sum"
alignmentBaseline?"inherit" | "text-after-edge" | "after-edge" | "central" | "middle" | "text-before-edge" | "before-edge" | "baseline" | "auto" | "mathematical" | "ideographic" | "hanging" | "alphabetic"
allowReorder?"yes" | "no"
alphabetic?number | string
amplitude?number | string
autoReverse?"false" | "true" | boolean
baseFrequency?number | string
baselineShift?number | string
baseProfile?number | string
capHeight?number | string
clipPathUnits?number | string
colorInterpolation?number | string
colorInterpolationFilters?"linearRGB" | "sRGB" | "inherit" | "auto"
colorProfile?number | string
colorRendering?number | string
contentScriptType?number | string
contentStyleType?number | string
dangerouslySetInnerHTML?object
decelerate?number | string
diffuseConstant?number | string
direction?number | string
dominantBaseline?"reset-size" | "no-change" | "use-script" | "inherit" | "text-after-edge" | "central" | "middle" | "text-before-edge" | "auto" | "mathematical" | "ideographic" | "hanging" | "alphabetic"
elevation?number | string
enableBackground?number | string
externalResourcesRequired?"false" | "true" | boolean
fillOpacity?number | string
fillRule?"evenodd" | "nonzero" | "inherit"
filterRes?number | string
filterUnits?number | string
floodColor?number | string
floodOpacity?number | string
focusable?"false" | "true" | "auto" | boolean
fontSizeAdjust?number | string
fontStretch?number | string
fontStyle?number | string
fontVariant?number | string
fontWeight?number | string
glyphName?number | string
glyphOrientationHorizontal?number | string
glyphOrientationVertical?number | string
horizAdvX?number | string
horizOriginX?number | string
ideographic?number | string
imageRendering?number | string
intercept?number | string
kernelMatrix?number | string
kernelUnitLength?number | string
key?bigint | number | string | null
keyPoints?number | string
keySplines?number | string
lengthAdjust?number | string
letterSpacing?number | string
lightingColor?number | string
limitingConeAngle?number | string
markerHeight?number | string
markerUnits?number | string
markerWidth?number | string
maskContentUnits?number | string
maskUnits?number | string
mathematical?number | string
numOctaves?number | string
onChange?ChangeEventHandler < object, object >
onSubmit?SubmitEventHandler < object >
orientation?number | string
overlinePosition?number | string
overlineThickness?number | string
paintOrder?number | string
pathLength?number | string
patternContentUnits?string
pointerEvents?number | string
pointsAtX?number | string
pointsAtY?number | string
pointsAtZ?number | string
preserveAlpha?"false" | "true" | boolean
preserveAspectRatio?string
primitiveUnits?number | string
renderingIntent?number | string
repeatCount?number | string
repeatDur?number | string
requiredExtensions?number | string
requiredFeatures?number | string
shapeRendering?number | string
size?array | number | string
specularConstant?number | string
specularExponent?number | string
startOffset?number | string
stdDeviation?number | string
stitchTiles?number | string
stopOpacity?number | string
strikethroughPosition?number | string
strikethroughThickness?number | string
strokeDasharray?number | string
strokeDashoffset?number | string
strokeLinecap?"square" | "round" | "butt" | "inherit"
strokeLinejoin?"bevel" | "miter" | "round" | "inherit"
strokeMiterlimit?number | string
strokeOpacity?number | string
strokeWidth?number | string
suppressHydrationWarning?boolean
surfaceScale?number | string
systemLanguage?number | string
tableValues?number | string
textAnchor?"start" | "inherit" | "middle" | "end"
textDecoration?number | string
textLength?number | string
textRendering?number | string
underlinePosition?number | string
underlineThickness?number | string
unicodeBidi?number | string
unicodeRange?number | string
unitsPerEm?number | string
vAlphabetic?number | string
vectorEffect?number | string
vertOriginX?number | string
vertOriginY?number | string
vIdeographic?number | string
viewTarget?number | string
visibility?number | string
vMathematical?number | string
wordSpacing?number | string
writingMode?number | string
Accessibility props (54) DOM event handlers (164)onContextMenu?MouseEventHandler < object >
onContextMenuCapture?MouseEventHandler < object >
Last update: 2 months ago