# Svg

> A declarative SVG canvas rendered natively.

- Category: [Text & media](https://tarve.dev/docs.md#text-media)
- Import: `import { Svg } from "@tarve/core";`
- Props type: `SvgProps`
- Source: [packages/core/src/components/svg.ts:153](https://github.com/omarcosr/tarve/blob/main/packages/core/src/components/svg.ts#L153)

## Usage

```tsx title="Svg.tsx"
import { Circle, Path, Svg } from "@tarve/core";

<Svg viewBox="0 0 24 24" size={48} stroke="#7c5cff" strokeWidth={2}>
  <Circle cx={12} cy={12} r={9} />
  <Path d="M8 12l3 3 5-6" />
</Svg>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `color` | `string` | `theme.colors.foreground` |  |
| `fill` | `string` | `"none"` |  |
| `height` | `number` | — |  |
| `nodes` | `readonly SvgNode[]` | `[]` |  |
| `size` | `number` | — |  |
| `stroke` | `string` | `"currentColor"` |  |
| `strokeLinecap` | `"butt" \| "round" \| "square"` | `"round"` |  |
| `strokeLinejoin` | `"miter" \| "round" \| "bevel"` | `"round"` |  |
| `strokeWidth` | `number` | `2` |  |
| `viewBox` | `string \| readonly [number, number, number, number]` | — |  |
| `width` | `number` | — |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `id`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

## Types

```ts title="SvgNode"
type SvgNode =
  | readonly [SvgElementName, SvgAttributes]
  | readonly [SvgElementName, SvgAttributes, readonly SvgNode[]];
```

Previous: [Icon](https://tarve.dev/docs/components/Icon.md) · Next: [Path](https://tarve.dev/docs/components/Path.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/Svg · Index for agents: https://tarve.dev/llms.txt
