SVG
Vector drawing in JSX: shapes, paths, gradients, markers and SVG text.
Import them from @inkoxide/react, @inkoxide/vue or @inkoxide/svelte; an Angular template writes them as <ink-svg>, <ink-g>, <ink-path>, <ink-rect>, <ink-circle>, <ink-ellipse>, <ink-line>, <ink-polyline>, <ink-polygon>, <ink-text>, <ink-tspan>, <ink-text-path>, <ink-defs>, <ink-clip-path>, <ink-marker>, <ink-linear-gradient>, <ink-radial-gradient>, <ink-stop>. Examples, and how these components work together, are in the guide.
Presentation attributes
SVG presentation attributes, camelCase (strokeWidth), as in React DOM. Every shape, G, Svg and SVG Text takes them, besides its own props below.
| Attribute | Type | Description |
|---|---|---|
fill | SvgPaint | |
fillOpacity | number | string | |
fillRule | 'nonzero' | 'evenodd' | |
stroke | SvgPaint | |
strokeWidth | number | string | |
strokeOpacity | number | string | |
strokeLinecap | 'butt' | 'round' | 'square' | |
strokeLinejoin | 'miter' | 'round' | 'bevel' | |
strokeDasharray | string | number[] | |
strokeDashoffset | number | string | |
strokeMiterlimit | number | string | |
opacity | number | string | |
transform | string | |
clipPath | string | |
clipRule | 'nonzero' | 'evenodd' | |
markerStart | string | A <Marker> drawn at the first vertex of a path, line or poly shape: url(#id). |
markerMid | string | A <Marker> drawn at every vertex between the first and the last: url(#id). |
markerEnd | string | A <Marker> drawn at the last vertex: url(#id). |
visibility | 'visible' | 'hidden' | 'collapse' | |
fontFamily | string | Text inside: the font, as in CSS. A family list ("Inter, sans-serif") is a stack. |
fontSize | number | string | |
fontWeight | number | FontWeightName | |
fontStyle | 'normal' | 'italic' | |
fontStretch | FontStretch | Text inside: its width, as fontStretch on a Text. |
textAnchor | 'start' | 'middle' | 'end' | Text inside: where its position is on the text (start, middle, end). |
dominantBaseline | | 'auto' | 'alphabetic' | 'middle' | 'central' | 'hanging' | 'mathematical' | 'ideographic' | 'text-before-edge' | 'text-after-edge' | Text inside: which line of the text sits at its y. |
id | string |
Svg
A vector drawing; becomes an SVG image. Use the SVG primitives (Path, Rect, …) inside.
import { Document, Page, Path, Rect, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={100} height={80} viewBox="0 0 100 80">
<Rect x={8} y={40} width={22} height={36} rx={3} fill="#f3c5b0" />
<Rect x={38} y={24} width={22} height={52} rx={3} fill="#e8956f" />
<Rect x={68} y={12} width={22} height={64} rx={3} fill="#c4471b" />
<Path d="M0 77 L120 77" stroke="#9ca3af" strokeWidth={1} />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Page, Path, Rect, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="100" :height="80" viewBox="0 0 100 80">
<Rect :x="8" :y="40" :width="22" :height="36" :rx="3" fill="#f3c5b0" />
<Rect :x="38" :y="24" :width="22" :height="52" :rx="3" fill="#e8956f" />
<Rect :x="68" :y="12" :width="22" :height="64" :rx="3" fill="#c4471b" />
<Path d="M0 77 L120 77" stroke="#9ca3af" :strokeWidth="1" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Page, Path, Rect, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={100} height={80} viewBox="0 0 100 80">
<Rect x={8} y={40} width={22} height={36} rx={3} fill="#f3c5b0" />
<Rect x={38} y={24} width={22} height={52} rx={3} fill="#e8956f" />
<Rect x={68} y={12} width={22} height={64} rx={3} fill="#c4471b" />
<Path d="M0 77 L120 77" stroke="#9ca3af" strokeWidth={1} />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="100" [height]="80" viewBox="0 0 100 80">
<ink-rect [x]="8" [y]="40" [width]="22" [height]="36" [rx]="3" fill="#f3c5b0" />
<ink-rect [x]="38" [y]="24" [width]="22" [height]="52" [rx]="3" fill="#e8956f" />
<ink-rect [x]="68" [y]="12" [width]="22" [height]="64" [rx]="3" fill="#c4471b" />
<ink-path d="M0 77 L120 77" stroke="#9ca3af" [strokeWidth]="1" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
width (required) | Length | Width and height of the drawing in the layout (points or units); also the SVG viewport. |
height (required) | Length | |
viewBox | string | |
preserveAspectRatio | string | |
className | string | Box utilities for the image the drawing becomes (margins, position, pages…). |
style | Style | |
pages | PageFilter | |
break | BreakProp | |
href | string | |
fixed | boolean | Repeats the drawing on every page, like fixed on a View. |
debug | boolean | Outlines the drawing's box. |
alt | string | The text the drawing copies and searches as: its alternative text, at most 1024 characters. |
role | 'figure' | 'artifact' | 'artifact': decoration in tagged output. |
It also takes the presentation attributes.
G
A group: its presentation attributes and transform apply to every shape inside it.
import { Circle, Document, G, Page, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<G fill="#c4471b" transform="translate(20 40)">
<Circle cx={0} cy={0} r={12} />
<Circle cx={40} cy={0} r={12} opacity={0.6} />
<Circle cx={80} cy={0} r={12} opacity={0.3} />
</G>
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Circle, Document, G, Page, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<G fill="#c4471b" transform="translate(20 40)">
<Circle :cx="0" :cy="0" :r="12" />
<Circle :cx="40" :cy="0" :r="12" :opacity="0.6" />
<Circle :cx="80" :cy="0" :r="12" :opacity="0.3" />
</G>
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Circle, Document, G, Page, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<G fill="#c4471b" transform="translate(20 40)">
<Circle cx={0} cy={0} r={12} />
<Circle cx={40} cy={0} r={12} opacity={0.6} />
<Circle cx={80} cy={0} r={12} opacity={0.3} />
</G>
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-g fill="#c4471b" transform="translate(20 40)">
<ink-circle [cx]="0" [cy]="0" [r]="12" />
<ink-circle [cx]="40" [cy]="0" [r]="12" [opacity]="0.6" />
<ink-circle [cx]="80" [cy]="0" [r]="12" [opacity]="0.3" />
</ink-g>
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
It also takes the presentation attributes.
Path
A shape drawn by the commands of d (M, L, C, Q, A, Z and the others of SVG).
import { Document, Page, Path, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Path d="M4 64 C 30 4, 60 4, 80 40 S 110 76, 116 16" fill="none" stroke="#c4471b" strokeWidth={3} strokeLinecap="round" />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Page, Path, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Path d="M4 64 C 30 4, 60 4, 80 40 S 110 76, 116 16" fill="none" stroke="#c4471b" :strokeWidth="3" strokeLinecap="round" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Page, Path, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Path d="M4 64 C 30 4, 60 4, 80 40 S 110 76, 116 16" fill="none" stroke="#c4471b" strokeWidth={3} strokeLinecap="round" />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-path d="M4 64 C 30 4, 60 4, 80 40 S 110 76, 116 16" fill="none" stroke="#c4471b" [strokeWidth]="3" strokeLinecap="round" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
d (required) | string | |
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
It also takes the presentation attributes.
Rect
A rectangle, with rounded corners when rx or ry is set.
import { Document, Page, Rect, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Rect x={4} y={10} width={112} height={60} rx={10} fill="#fbe3d6" stroke="#c4471b" strokeWidth={2} />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Page, Rect, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Rect :x="4" :y="10" :width="112" :height="60" :rx="10" fill="#fbe3d6" stroke="#c4471b" :strokeWidth="2" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Page, Rect, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Rect x={4} y={10} width={112} height={60} rx={10} fill="#fbe3d6" stroke="#c4471b" strokeWidth={2} />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-rect [x]="4" [y]="10" [width]="112" [height]="60" [rx]="10" fill="#fbe3d6" stroke="#c4471b" [strokeWidth]="2" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
x | number | string | |
y | number | string | |
width (required) | number | string | |
height (required) | number | string | |
rx | number | string | |
ry | number | string | |
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
It also takes the presentation attributes.
Circle
A circle of radius r around cx, cy.
import { Circle, Document, Page, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Circle cx={60} cy={40} r={32} fill="#fbe3d6" stroke="#c4471b" strokeWidth={3} />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Circle, Document, Page, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Circle :cx="60" :cy="40" :r="32" fill="#fbe3d6" stroke="#c4471b" :strokeWidth="3" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Circle, Document, Page, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Circle cx={60} cy={40} r={32} fill="#fbe3d6" stroke="#c4471b" strokeWidth={3} />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-circle [cx]="60" [cy]="40" [r]="32" fill="#fbe3d6" stroke="#c4471b" [strokeWidth]="3" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
cx | number | string | |
cy | number | string | |
r (required) | number | string | |
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
It also takes the presentation attributes.
Ellipse
An ellipse of radii rx and ry around cx, cy.
import { Document, Ellipse, Page, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Ellipse cx={60} cy={40} rx={54} ry={26} fill="#fbe3d6" stroke="#c4471b" strokeWidth={2} />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Ellipse, Page, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Ellipse :cx="60" :cy="40" :rx="54" :ry="26" fill="#fbe3d6" stroke="#c4471b" :strokeWidth="2" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Ellipse, Page, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Ellipse cx={60} cy={40} rx={54} ry={26} fill="#fbe3d6" stroke="#c4471b" strokeWidth={2} />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-ellipse [cx]="60" [cy]="40" [rx]="54" [ry]="26" fill="#fbe3d6" stroke="#c4471b" [strokeWidth]="2" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
cx | number | string | |
cy | number | string | |
rx (required) | number | string | |
ry (required) | number | string | |
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
It also takes the presentation attributes.
Line
A straight line from x1, y1 to x2, y2.
import { Document, Line, Page, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Line x1={8} y1={70} x2={112} y2={10} stroke="#c4471b" strokeWidth={3} strokeDasharray="8 5" />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Line, Page, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Line :x1="8" :y1="70" :x2="112" :y2="10" stroke="#c4471b" :strokeWidth="3" strokeDasharray="8 5" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Line, Page, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Line x1={8} y1={70} x2={112} y2={10} stroke="#c4471b" strokeWidth={3} strokeDasharray="8 5" />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-line [x1]="8" [y1]="70" [x2]="112" [y2]="10" stroke="#c4471b" [strokeWidth]="3" strokeDasharray="8 5" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
x1 (required) | number | string | |
y1 (required) | number | string | |
x2 (required) | number | string | |
y2 (required) | number | string | |
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
It also takes the presentation attributes.
Polyline
Straight lines through points, left open.
import { Document, Page, Polyline, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Polyline points="4,70 28,44 52,54 76,22 100,32 116,8" fill="none" stroke="#c4471b" strokeWidth={3} strokeLinejoin="round" />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Page, Polyline, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Polyline points="4,70 28,44 52,54 76,22 100,32 116,8" fill="none" stroke="#c4471b" :strokeWidth="3" strokeLinejoin="round" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Page, Polyline, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Polyline points="4,70 28,44 52,54 76,22 100,32 116,8" fill="none" stroke="#c4471b" strokeWidth={3} strokeLinejoin="round" />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-polyline points="4,70 28,44 52,54 76,22 100,32 116,8" fill="none" stroke="#c4471b" [strokeWidth]="3" strokeLinejoin="round" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
points (required) | string | number[] | |
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
It also takes the presentation attributes.
Polygon
Straight lines through points, closed back to the first.
import { Document, Page, Polygon, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Polygon points="60,4 74,30 104,32 80,50 88,78 60,62 32,78 40,50 16,32 46,30" fill="#e8956f" stroke="#c4471b" strokeWidth={2} />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Page, Polygon, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Polygon points="60,4 74,30 104,32 80,50 88,78 60,62 32,78 40,50 16,32 46,30" fill="#e8956f" stroke="#c4471b" :strokeWidth="2" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Page, Polygon, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Polygon points="60,4 74,30 104,32 80,50 88,78 60,62 32,78 40,50 16,32 46,30" fill="#e8956f" stroke="#c4471b" strokeWidth={2} />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-polygon points="60,4 74,30 104,32 80,50 88,78 60,62 32,78 40,50 16,32 46,30" fill="#e8956f" stroke="#c4471b" [strokeWidth]="2" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
points (required) | string | number[] | |
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
It also takes the presentation attributes.
Text in an Svg
A Text inside an <Svg>: SVG text, positioned in the drawing's coordinates.
import { Document, Page, Rect, Svg, Text, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={160} height={60} viewBox="0 0 160 60">
<Rect width={160} height={60} rx={6} fill="#fbe3d6" />
<Text x={80} y={28} textAnchor="middle" fontWeight="bold" fill="#c4471b">
Revenue
</Text>
<Text x={80} y={46} textAnchor="middle" fontSize={9} letterSpacing={1}>
Q3 2026
</Text>
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Page, Rect, Svg, Text, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="160" :height="60" viewBox="0 0 160 60">
<Rect :width="160" :height="60" :rx="6" fill="#fbe3d6" />
<Text :x="80" :y="28" textAnchor="middle" fontWeight="bold" fill="#c4471b">
Revenue
</Text>
<Text :x="80" :y="46" textAnchor="middle" :fontSize="9" :letterSpacing="1">
Q3 2026
</Text>
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Page, Rect, Svg, Text, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={160} height={60} viewBox="0 0 160 60">
<Rect width={160} height={60} rx={6} fill="#fbe3d6" />
<Text x={80} y={28} textAnchor="middle" fontWeight="bold" fill="#c4471b">
Revenue
</Text>
<Text x={80} y={46} textAnchor="middle" fontSize={9} letterSpacing={1}>
Q3 2026
</Text>
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="160" [height]="60" viewBox="0 0 160 60">
<ink-rect [width]="160" [height]="60" [rx]="6" fill="#fbe3d6" />
<ink-text [x]="80" [y]="28" textAnchor="middle" fontWeight="bold" fill="#c4471b">
Revenue
</ink-text>
<ink-text [x]="80" [y]="46" textAnchor="middle" [fontSize]="9" [letterSpacing]="1">
Q3 2026
</ink-text>
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
x | SvgNumberList | Where the text starts (with textAnchor); a list positions each character. |
y | SvgNumberList | |
dx | SvgNumberList | Shifts from where each character would be. |
dy | SvgNumberList | |
rotate | SvgNumberList | Degrees each character is turned; the last value repeats. |
letterSpacing | number | string | |
wordSpacing | number | string | |
textDecoration | string | underline, overline, line-through, or several. |
textLength | number | string | The width to fit the text to, by its spacing or (lengthAdjust) its glyphs too. |
lengthAdjust | 'spacing' | 'spacingAndGlyphs' | |
direction | 'ltr' | 'rtl' | |
writingMode | 'horizontal-tb' | 'vertical-rl' | 'vertical-lr' | 'sideways-rl' | 'sideways-lr' | The direction of the line: vertical-rl and vertical-lr (the same for one line) go down, sideways-rl down with every character turned, sideways-lr up. Read on the Text. |
textOrientation | 'mixed' | 'upright' | 'sideways' | How characters stand in vertical text: mixed (the default) stands CJK upright and turns Latin sideways, upright stands every character, sideways turns every one. |
fontFeatureSettings | string | OpenType features, as in CSS: "'tnum', 'liga' off". |
fontVariant | string | small-caps, tabular-nums, no-common-ligatures, … as in CSS. |
fontKerning | 'auto' | 'normal' | 'none' | none turns kerning off. |
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
It also takes the presentation attributes.
Tspan
A span of SVG text, inside a Text in an <Svg>: its own position, font or paint.
import { Document, Page, Rect, Svg, Text, Tspan, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={160} height={60} viewBox="0 0 160 60">
<Rect width={160} height={60} rx={6} fill="#f5f5f4" />
<Text x={80} y={36} textAnchor="middle" fontWeight="bold">
Revenue <Tspan fill="#16a34a">+12%</Tspan>
</Text>
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Document, Page, Rect, Svg, Text, Tspan, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="160" :height="60" viewBox="0 0 160 60">
<Rect :width="160" :height="60" :rx="6" fill="#f5f5f4" />
<Text :x="80" :y="36" textAnchor="middle" fontWeight="bold">
Revenue <Tspan fill="#16a34a">+12%</Tspan></Text>
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Document, Page, Rect, Svg, Text, Tspan, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={160} height={60} viewBox="0 0 160 60">
<Rect width={160} height={60} rx={6} fill="#f5f5f4" />
<Text x={80} y={36} textAnchor="middle" fontWeight="bold">
Revenue <Tspan fill="#16a34a">+12%</Tspan></Text>
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="160" [height]="60" viewBox="0 0 160 60">
<ink-rect [width]="160" [height]="60" [rx]="6" fill="#f5f5f4" />
<ink-text [x]="80" [y]="36" textAnchor="middle" fontWeight="bold">
Revenue <ink-tspan fill="#16a34a">+12%</ink-tspan></ink-text>
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
baselineShift | number | string | Raises (positive, super) or lowers (sub) the span from the baseline. |
alignmentBaseline | SvgPresentation['dominantBaseline'] | |
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
x | SvgNumberList | Where the text starts (with textAnchor); a list positions each character. |
y | SvgNumberList | |
dx | SvgNumberList | Shifts from where each character would be. |
dy | SvgNumberList | |
rotate | SvgNumberList | Degrees each character is turned; the last value repeats. |
letterSpacing | number | string | |
wordSpacing | number | string | |
textDecoration | string | underline, overline, line-through, or several. |
textLength | number | string | The width to fit the text to, by its spacing or (lengthAdjust) its glyphs too. |
lengthAdjust | 'spacing' | 'spacingAndGlyphs' | |
direction | 'ltr' | 'rtl' | |
textOrientation | 'mixed' | 'upright' | 'sideways' | How characters stand in vertical text: mixed (the default) stands CJK upright and turns Latin sideways, upright stands every character, sideways turns every one. |
fontFeatureSettings | string | OpenType features, as in CSS: "'tnum', 'liga' off". |
fontVariant | string | small-caps, tabular-nums, no-common-ligatures, … as in CSS. |
fontKerning | 'auto' | 'normal' | 'none' | none turns kerning off. |
It also takes the presentation attributes.
TextPath
Text along a path or shape (href="#curve"), directly inside a Text in an <Svg>.
import { Defs, Document, Page, Path, Svg, Text, TextPath, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={200} height={90} viewBox="0 0 200 90">
<Defs>
<Path id="curve" d="M10 80 Q 100 0 190 80" />
</Defs>
<Path d="M10 80 Q 100 0 190 80" fill="none" stroke="#f3c5b0" strokeWidth={1} />
<Text fontSize={13} fill="#c4471b">
<TextPath href="#curve" startOffset="50%" textAnchor="middle">
Along the curve
</TextPath>
</Text>
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Defs, Document, Page, Path, Svg, Text, TextPath, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="200" :height="90" viewBox="0 0 200 90">
<Defs>
<Path id="curve" d="M10 80 Q 100 0 190 80" />
</Defs>
<Path d="M10 80 Q 100 0 190 80" fill="none" stroke="#f3c5b0" :strokeWidth="1" />
<Text :fontSize="13" fill="#c4471b">
<TextPath href="#curve" startOffset="50%" textAnchor="middle">
Along the curve
</TextPath>
</Text>
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Defs, Document, Page, Path, Svg, Text, TextPath, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={200} height={90} viewBox="0 0 200 90">
<Defs>
<Path id="curve" d="M10 80 Q 100 0 190 80" />
</Defs>
<Path d="M10 80 Q 100 0 190 80" fill="none" stroke="#f3c5b0" strokeWidth={1} />
<Text fontSize={13} fill="#c4471b">
<TextPath href="#curve" startOffset="50%" textAnchor="middle">
Along the curve
</TextPath>
</Text>
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="200" [height]="90" viewBox="0 0 200 90">
<ink-defs>
<ink-path id="curve" d="M10 80 Q 100 0 190 80" />
</ink-defs>
<ink-path d="M10 80 Q 100 0 190 80" fill="none" stroke="#f3c5b0" [strokeWidth]="1" />
<ink-text [fontSize]="13" fill="#c4471b">
<ink-text-path href="#curve" startOffset="50%" textAnchor="middle">
Along the curve
</ink-text-path>
</ink-text>
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
href | string | The path or basic shape to follow, by id: #curve. |
path | string | Path data to follow instead of an element (SVG 2). |
startOffset | number | string | Where the text starts along the path: a length, or a percentage of the path's length. |
side | 'left' | 'right' | right follows the path the other way. |
method | 'align' | 'stretch' | Accepted, as in SVG 2; glyphs are not warped. |
spacing | 'auto' | 'exact' | Accepted, as in SVG 2; the font's spacing is kept. |
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
letterSpacing | number | string | |
wordSpacing | number | string | |
textDecoration | string | underline, overline, line-through, or several. |
textLength | number | string | The width to fit the text to, by its spacing or (lengthAdjust) its glyphs too. |
lengthAdjust | 'spacing' | 'spacingAndGlyphs' | |
direction | 'ltr' | 'rtl' | |
textOrientation | 'mixed' | 'upright' | 'sideways' | How characters stand in vertical text: mixed (the default) stands CJK upright and turns Latin sideways, upright stands every character, sideways turns every one. |
fontFeatureSettings | string | OpenType features, as in CSS: "'tnum', 'liga' off". |
fontVariant | string | small-caps, tabular-nums, no-common-ligatures, … as in CSS. |
fontKerning | 'auto' | 'normal' | 'none' | none turns kerning off. |
It also takes the presentation attributes.
Defs
What other elements refer to by id (gradients, clip paths, markers), not drawn where it stands.
import { Defs, Document, LinearGradient, Page, Rect, Stop, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<LinearGradient id="fade" x1={0} y1={0} x2={1} y2={0}>
<Stop offset={0} stopColor="#c4471b" />
<Stop offset={1} stopColor="#f3c5b0" />
</LinearGradient>
</Defs>
<Rect x={4} y={16} width={112} height={48} rx={8} fill="url(#fade)" />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Defs, Document, LinearGradient, Page, Rect, Stop, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Defs>
<LinearGradient id="fade" :x1="0" :y1="0" :x2="1" :y2="0">
<Stop :offset="0" stopColor="#c4471b" />
<Stop :offset="1" stopColor="#f3c5b0" />
</LinearGradient>
</Defs>
<Rect :x="4" :y="16" :width="112" :height="48" :rx="8" fill="url(#fade)" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Defs, Document, LinearGradient, Page, Rect, Stop, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<LinearGradient id="fade" x1={0} y1={0} x2={1} y2={0}>
<Stop offset={0} stopColor="#c4471b" />
<Stop offset={1} stopColor="#f3c5b0" />
</LinearGradient>
</Defs>
<Rect x={4} y={16} width={112} height={48} rx={8} fill="url(#fade)" />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-defs>
<ink-linear-gradient id="fade" [x1]="0" [y1]="0" [x2]="1" [y2]="0">
<ink-stop [offset]="0" stopColor="#c4471b" />
<ink-stop [offset]="1" stopColor="#f3c5b0" />
</ink-linear-gradient>
</ink-defs>
<ink-rect [x]="4" [y]="16" [width]="112" [height]="48" [rx]="8" fill="url(#fade)" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

It takes no props.
ClipPath
A shape that clips what refers to it with clipPath="url(#id)".
import { Circle, ClipPath, Defs, Document, G, Page, Rect, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<ClipPath id="disc">
<Circle cx={60} cy={40} r={34} />
</ClipPath>
</Defs>
<G clipPath="url(#disc)">
<Rect x={0} y={0} width={120} height={40} fill="#e8956f" />
<Rect x={0} y={40} width={120} height={40} fill="#5e3428" />
</G>
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Circle, ClipPath, Defs, Document, G, Page, Rect, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Defs>
<ClipPath id="disc">
<Circle :cx="60" :cy="40" :r="34" />
</ClipPath>
</Defs>
<G clipPath="url(#disc)">
<Rect :x="0" :y="0" :width="120" :height="40" fill="#e8956f" />
<Rect :x="0" :y="40" :width="120" :height="40" fill="#5e3428" />
</G>
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Circle, ClipPath, Defs, Document, G, Page, Rect, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<ClipPath id="disc">
<Circle cx={60} cy={40} r={34} />
</ClipPath>
</Defs>
<G clipPath="url(#disc)">
<Rect x={0} y={0} width={120} height={40} fill="#e8956f" />
<Rect x={0} y={40} width={120} height={40} fill="#5e3428" />
</G>
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-defs>
<ink-clip-path id="disc">
<ink-circle [cx]="60" [cy]="40" [r]="34" />
</ink-clip-path>
</ink-defs>
<ink-g clipPath="url(#disc)">
<ink-rect [x]="0" [y]="0" [width]="120" [height]="40" fill="#e8956f" />
<ink-rect [x]="0" [y]="40" [width]="120" [height]="40" fill="#5e3428" />
</ink-g>
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
id (required) | string | Referenced as clipPath="url(#id)". |
clipPathUnits | 'userSpaceOnUse' | 'objectBoundingBox' | What the contents' coordinates are in: the user space (default) or the clipped shape's bounding box. |
Marker
A shape drawn at the vertices of the paths, lines and poly shapes that reference it through markerStart, markerMid or markerEnd. Defined once, in Defs.
import { Defs, Document, Line, Marker, Page, Path, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<Marker id="arrow" viewBox="0 0 10 10" refX={8} refY={5} markerWidth={6} markerHeight={6} orient="auto-start-reverse">
<Path d="M0 0 L10 5 L0 10 z" fill="#c4471b" />
</Marker>
</Defs>
<Line x1={12} y1={40} x2={108} y2={40} stroke="#c4471b" strokeWidth={2} markerStart="url(#arrow)" markerEnd="url(#arrow)" />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Defs, Document, Line, Marker, Page, Path, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Defs>
<Marker id="arrow" viewBox="0 0 10 10" :refX="8" :refY="5" :markerWidth="6" :markerHeight="6" orient="auto-start-reverse">
<Path d="M0 0 L10 5 L0 10 z" fill="#c4471b" />
</Marker>
</Defs>
<Line :x1="12" :y1="40" :x2="108" :y2="40" stroke="#c4471b" :strokeWidth="2" markerStart="url(#arrow)" markerEnd="url(#arrow)" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Defs, Document, Line, Marker, Page, Path, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<Marker id="arrow" viewBox="0 0 10 10" refX={8} refY={5} markerWidth={6} markerHeight={6} orient="auto-start-reverse">
<Path d="M0 0 L10 5 L0 10 z" fill="#c4471b" />
</Marker>
</Defs>
<Line x1={12} y1={40} x2={108} y2={40} stroke="#c4471b" strokeWidth={2} markerStart="url(#arrow)" markerEnd="url(#arrow)" />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-defs>
<ink-marker id="arrow" viewBox="0 0 10 10" [refX]="8" [refY]="5" [markerWidth]="6" [markerHeight]="6" orient="auto-start-reverse">
<ink-path d="M0 0 L10 5 L0 10 z" fill="#c4471b" />
</ink-marker>
</ink-defs>
<ink-line [x1]="12" [y1]="40" [x2]="108" [y2]="40" stroke="#c4471b" [strokeWidth]="2" markerStart="url(#arrow)" markerEnd="url(#arrow)" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
id (required) | string | Referenced as markerStart="url(#id)" (or markerMid, markerEnd). |
viewBox | string | |
preserveAspectRatio | string | |
refX | number | string | The point of the marker's contents placed on the vertex, in viewBox units. |
refY | number | string | |
markerWidth | number | string | The size of the marker's viewport; 3 × 3 by default. |
markerHeight | number | string | |
orient | 'auto' | 'auto-start-reverse' | number | string | Turns the marker with the path's direction at the vertex ('auto'), the same but reversed at the start ('auto-start-reverse', for arrows at both ends), or by a fixed angle in degrees. |
markerUnits | 'strokeWidth' | 'userSpaceOnUse' | strokeWidth (default) scales the marker by the shape's stroke width; userSpaceOnUse does not. |
className | string | Tailwind classes, over the SVG attributes: fill-*, stroke-*, stroke-<n>, opacity-*, a text colour (currentColor) and the font utilities. |
style | SvgStyle | SVG presentation, over the attributes and className. |
It also takes the presentation attributes.
LinearGradient
A gradient along a line, used as a paint: fill="url(#id)".
import { Defs, Document, LinearGradient, Page, Rect, Stop, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<LinearGradient id="sky" x1={0} y1={0} x2={0} y2={1}>
<Stop offset={0} stopColor="#f6c79a" />
<Stop offset={1} stopColor="#9c5a43" />
</LinearGradient>
</Defs>
<Rect x={4} y={4} width={112} height={72} rx={8} fill="url(#sky)" />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Defs, Document, LinearGradient, Page, Rect, Stop, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Defs>
<LinearGradient id="sky" :x1="0" :y1="0" :x2="0" :y2="1">
<Stop :offset="0" stopColor="#f6c79a" />
<Stop :offset="1" stopColor="#9c5a43" />
</LinearGradient>
</Defs>
<Rect :x="4" :y="4" :width="112" :height="72" :rx="8" fill="url(#sky)" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Defs, Document, LinearGradient, Page, Rect, Stop, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<LinearGradient id="sky" x1={0} y1={0} x2={0} y2={1}>
<Stop offset={0} stopColor="#f6c79a" />
<Stop offset={1} stopColor="#9c5a43" />
</LinearGradient>
</Defs>
<Rect x={4} y={4} width={112} height={72} rx={8} fill="url(#sky)" />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-defs>
<ink-linear-gradient id="sky" [x1]="0" [y1]="0" [x2]="0" [y2]="1">
<ink-stop [offset]="0" stopColor="#f6c79a" />
<ink-stop [offset]="1" stopColor="#9c5a43" />
</ink-linear-gradient>
</ink-defs>
<ink-rect [x]="4" [y]="4" [width]="112" [height]="72" [rx]="8" fill="url(#sky)" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
id (required) | string | |
x1 | number | string | |
y1 | number | string | |
x2 | number | string | |
y2 | number | string | |
cx | number | string | |
cy | number | string | |
r | number | string | |
fx | number | string | |
fy | number | string | |
fr | number | string | Radius of the focal circle of a radial gradient. |
gradientUnits | 'userSpaceOnUse' | 'objectBoundingBox' | |
gradientTransform | string |
RadialGradient
A gradient out from a centre, used as a paint: fill="url(#id)".
import { Circle, Defs, Document, Page, RadialGradient, Stop, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<RadialGradient id="sun" cx={0.4} cy={0.4} r={0.6}>
<Stop offset={0} stopColor="#fff4e2" />
<Stop offset={1} stopColor="#e8956f" />
</RadialGradient>
</Defs>
<Circle cx={60} cy={40} r={34} fill="url(#sun)" />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Circle, Defs, Document, Page, RadialGradient, Stop, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Defs>
<RadialGradient id="sun" :cx="0.4" :cy="0.4" :r="0.6">
<Stop :offset="0" stopColor="#fff4e2" />
<Stop :offset="1" stopColor="#e8956f" />
</RadialGradient>
</Defs>
<Circle :cx="60" :cy="40" :r="34" fill="url(#sun)" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Circle, Defs, Document, Page, RadialGradient, Stop, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<RadialGradient id="sun" cx={0.4} cy={0.4} r={0.6}>
<Stop offset={0} stopColor="#fff4e2" />
<Stop offset={1} stopColor="#e8956f" />
</RadialGradient>
</Defs>
<Circle cx={60} cy={40} r={34} fill="url(#sun)" />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-defs>
<ink-radial-gradient id="sun" [cx]="0.4" [cy]="0.4" [r]="0.6">
<ink-stop [offset]="0" stopColor="#fff4e2" />
<ink-stop [offset]="1" stopColor="#e8956f" />
</ink-radial-gradient>
</ink-defs>
<ink-circle [cx]="60" [cy]="40" [r]="34" fill="url(#sun)" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
id (required) | string | |
x1 | number | string | |
y1 | number | string | |
x2 | number | string | |
y2 | number | string | |
cx | number | string | |
cy | number | string | |
r | number | string | |
fx | number | string | |
fy | number | string | |
fr | number | string | Radius of the focal circle of a radial gradient. |
gradientUnits | 'userSpaceOnUse' | 'objectBoundingBox' | |
gradientTransform | string |
Stop
A colour of a gradient, at its offset (0 to 1).
import { Defs, Document, LinearGradient, Page, Rect, Stop, Svg, View } from '@inkoxide/react';
export default function Example() {
return (
<Document>
<Page size={[320, 140]}>
<View className="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<LinearGradient id="bands" x1={0} y1={0} x2={1} y2={0}>
<Stop offset={0} stopColor="#c4471b" />
<Stop offset={0.5} stopColor="#f3c5b0" stopOpacity={0.6} />
<Stop offset={1} stopColor="#5e3428" />
</LinearGradient>
</Defs>
<Rect x={4} y={20} width={112} height={40} rx={6} fill="url(#bands)" />
</Svg>
</View>
</Page>
</Document>
);
}
<script setup lang="ts">
import { Defs, Document, LinearGradient, Page, Rect, Stop, Svg, View } from '@inkoxide/vue';
</script>
<template>
<Document>
<Page :size="[320, 140]">
<View class="flex-1 items-center justify-center">
<Svg :width="120" :height="80" viewBox="0 0 120 80">
<Defs>
<LinearGradient id="bands" :x1="0" :y1="0" :x2="1" :y2="0">
<Stop :offset="0" stopColor="#c4471b" />
<Stop :offset="0.5" stopColor="#f3c5b0" :stopOpacity="0.6" />
<Stop :offset="1" stopColor="#5e3428" />
</LinearGradient>
</Defs>
<Rect :x="4" :y="20" :width="112" :height="40" :rx="6" fill="url(#bands)" />
</Svg>
</View>
</Page>
</Document>
</template>
<script lang="ts">
import { Defs, Document, LinearGradient, Page, Rect, Stop, Svg, View } from '@inkoxide/svelte';
</script>
<Document>
<Page size={[320, 140]}>
<View class="flex-1 items-center justify-center">
<Svg width={120} height={80} viewBox="0 0 120 80">
<Defs>
<LinearGradient id="bands" x1={0} y1={0} x2={1} y2={0}>
<Stop offset={0} stopColor="#c4471b" />
<Stop offset={0.5} stopColor="#f3c5b0" stopOpacity={0.6} />
<Stop offset={1} stopColor="#5e3428" />
</LinearGradient>
</Defs>
<Rect x={4} y={20} width={112} height={40} rx={6} fill="url(#bands)" />
</Svg>
</View>
</Page>
</Document>
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({
selector: 'app-example',
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<ink-document>
<ink-page [size]="[320, 140]">
<ink-view class="flex-1 items-center justify-center">
<ink-svg [width]="120" [height]="80" viewBox="0 0 120 80">
<ink-defs>
<ink-linear-gradient id="bands" [x1]="0" [y1]="0" [x2]="1" [y2]="0">
<ink-stop [offset]="0" stopColor="#c4471b" />
<ink-stop [offset]="0.5" stopColor="#f3c5b0" [stopOpacity]="0.6" />
<ink-stop [offset]="1" stopColor="#5e3428" />
</ink-linear-gradient>
</ink-defs>
<ink-rect [x]="4" [y]="20" [width]="112" [height]="40" [rx]="6" fill="url(#bands)" />
</ink-svg>
</ink-view>
</ink-page>
</ink-document>
`,
})
export class Example {}

| Prop | Type | Description |
|---|---|---|
offset (required) | number | string | |
stopColor (required) | string | |
stopOpacity | number | string |
Synced from components/svg.md in the inkoxide repository.