A lightweight React component for dynamically fetching, modifying, and rendering inline SVGs with class support and error handling.
We welcome contributions to the react-tailwind-svg
project! If you encounter any issues or would like to contribute, feel free to open an issue or a pull request on our GitHub repository.
If you face any issues or have suggestions for improvement, please raise an issue on GitHub.
currentColor
for better theming.Install the package using NPM or Yarn:
npm install react-tailwind-svg
Or
yarn add react-tailwind-svg
Here’s how you can use the InlineSvgLoader
in your React project. It supports custom class names, including Tailwind CSS classes, for styling.
import React from 'react';
import InlineSvgLoader from 'react-tailwind-svg';
const App = () => {
return (
<div>
<h1>SVG Loader Example</h1>
<InlineSvgLoader
src="/path/to/your/svg.svg"
className="h-10 w-10 text-blue-500 dark:text-red-500"
/>
</div>
);
};
export default App;
### Props
| Prop | Type | Required | Description |
|------------|----------|----------|-------------------------------------------------------|
| `src` | `string` | Yes | URL of the SVG to fetch. |
| `className`| `string` | No | Custom class name for styling, including Tailwind CSS.|