Animated SVG Chart
This Month:
+112%
Installation
Edit tailwind.config.ts to add background grid
1
Install the package if you do not have it.
npm i framer-motion mini-svg-data-uri
2
Copy and paste the following code into your project.
//@ts-ignore
import { default as flattenColorPalette } from 'tailwindcss/lib/util/flattenColorPalette'
import svgToDataUri from 'mini-svg-data-uri'
const config = {
//...
plugins: [
function ({ matchUtilities, theme }: any) {
matchUtilities(
{
'bg-grid': (value: any) => ({
backgroundImage: `url("${svgToDataUri(
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32" fill="none" stroke="${value}"><path d="M0 .5H31.5V32"/></svg>`
)}")`
})
},
{ values: flattenColorPalette(theme('backgroundColor')), type: 'color' }
)
}
]
}
export default config
3