# Icon

> Built-in stroke icons, or any icon from an SVG node list.

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

## Usage

```tsx title="Icon.tsx"
import { Icon, Row } from "@tarve/core";

<Row gap={12} align="center">
  <Icon name="settings" size={20} />
  <Icon name="heart" size={20} color="#f472b6" />
  <Icon iconNode={[["path", { d: "M5 12h14M12 5l7 7-7 7" }]]} size={20} strokeWidth={2} />
</Row>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `color` | `string` | `theme.colors.foreground` |  |
| `iconNode` | `readonly SvgNode[]` | — |  |
| `name` | `IconName` | — |  |
| `size` | `number` | `16` |  |
| `strokeWidth` | `number` | `1.75` |  |

## 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="IconName"
type IconName =
  | "check" | "x" | "plus" | "minus"
  | "chevron-down" | "chevron-up" | "chevron-right" | "chevron-left"
  | "search" | "info"
  | "house" | "settings" | "user" | "bell" | "heart" | "star"
  | "download" | "trash-2" | "folder" | "mail"
  | "play" | "pause" | "skip-back" | "skip-forward";
```

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

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

---

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