---
title: "MazIcon"
description: "A flexible icon component that accepts Vue components, raw SVG strings, URLs and data URIs."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-icon"
---
# MazIcon
> A flexible icon component that accepts Vue components, raw SVG strings, URLs and data URIs.
- Package: `maz-ui`
- Import: `import MazIcon from 'maz-ui/components/MazIcon'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-icon
**Tip:**
Download the bundled icons pack or use [`@maz-ui/icons`](../ecosystem/icons/index.md) for the full set.
## How it works
Pass an `icon` prop in any of the supported formats - the component detects what it received and renders accordingly:
| Input | Example | Use it for |
| --- | --- | --- |
| **Vue component** | `import { MazStar } from '@maz-ui/icons/static/MazStar'` | Always-rendered icons that you also want available as a standalone component (``). |
| **Raw SVG string** | `import { MazStar } from '@maz-ui/icons/raw/MazStar'` | Always-rendered icons - the lightest format, no Vue component overhead. |
| **URL or `data:` URI** | `'/icons/star.svg'`, `'data:image/svg+xml,…'` | SVGs hosted in your `public/` folder or external CDN. Fetched and cached on demand. |
```vue
```
## Examples
### Raw SVG (recommended)
```vue
```
### URL (fetched at runtime)
Place your SVG file in your `public/` folder, then point `icon` to its path. The component caches the fetched payload and shares it across instances.
```vue
```
### Vue component
```vue
```
## Fallback
When the URL fetch fails, an `error` event is emitted and `MazIcon` switches to the `fallback` prop (same shape as `icon`). If neither resolves, the bundled `MazQuestionMarkCircle` is rendered.
```vue
```
## Sizing
### Predefined sizes (`'xs' | 'sm' | 'md' | 'lg' | 'xl'`)
```vue
```
### Custom size (any CSS length)
Allowed units: `px`, `em`, `rem`, `%`, `vw`, `vh`, `cm`, `mm`, `in`, `pt`, `pc`, `ex`.
```vue
```
## Accessibility
By default `MazIcon` is rendered as decorative (`aria-hidden="true"`, no `role`). Provide an `aria-label` (either on `` or in `svgAttributes`) to expose it to assistive tech - `role="img"` is set automatically and `aria-hidden` is dropped.
```vue
```
## RTL flipping
Set `flip-icon-for-rtl` on directional icons (chevrons, arrows). The icon is mirrored horizontally when the document direction is `rtl` and rendered unchanged otherwise.
```vue
```
## Custom SVG attributes
Inject extra attributes onto the rendered `