svg.mdx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ---
  2. title: SVG version
  3. description: Download Tabler Icons in SVG format.
  4. ---
  5. ![](/docs/icons/package-svg.png)
  6. ## Installation
  7. <TabsPackage name="@tabler/icons" />
  8. or just [download from Github](https://github.com/tabler/tabler-icons/releases).
  9. ## Usage
  10. All icons are built with SVG, so you can place them as `<img>`, `background-image` and inline in HTML code.
  11. ### HTML image
  12. If you load an icon as an image, you can modify its size using CSS.
  13. ```html
  14. <img src="path/to/icon.svg" alt="icon title" />
  15. ```
  16. ### Inline HTML
  17. You can paste the content of the icon file into your HTML code to display it on the page.
  18. ```html
  19. <a href="">
  20. <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-disabled" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.25" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  21. ...
  22. </svg>
  23. Click me
  24. </a>
  25. ```
  26. Thanks to that, you can change the size, color and the `stroke-width` of the icons with CSS code.
  27. ```css
  28. .icon-tabler {
  29. color: red;
  30. width: 32px;
  31. height: 32px;
  32. stroke-width: 1.25;
  33. }
  34. ```
  35. ### SVG sprite
  36. Add an icon to be displayed on your page with the following markup (`activity` in the above example can be replaced with any valid icon name):
  37. ```html
  38. <svg width="24" height="24">
  39. <use xlink:href="path/to/tabler-sprite.svg#tabler-activity" />
  40. </svg>
  41. ```
  42. ## CDN
  43. Replace `$ICONS_VERSION` with `latest` or any specific version you need.
  44. #### Outline version
  45. ```html
  46. <img src="https://unpkg.com/@tabler/icons@$ICONS_VERSION/icons/outline/home.svg" />
  47. ```
  48. #### Filled version
  49. ```html
  50. <img src="https://unpkg.com/@tabler/icons@$ICONS_VERSION/icons/filled/home.svg" />
  51. ```