Skip to content

Instantly share code, notes, and snippets.

@tadeaspetak
Created April 26, 2021 04:47
Show Gist options
  • Save tadeaspetak/c51e070b78a6251e4834baba2184254f to your computer and use it in GitHub Desktop.
Save tadeaspetak/c51e070b78a6251e4834baba2184254f to your computer and use it in GitHub Desktop.
Simple react + tailwind spinner
export const Spinner: React.FC<{ size: 4 | 8 | 12 | 16; stroke?: number }> = ({
size,
stroke = 1,
}) => {
return (
<svg
className={`text-green-700 animate-spin w-${size}`}
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="-2 -2 28 28"
>
<circle
className="opacity-25"
cx="12"
cy="12"
r="12"
stroke="currentColor"
strokeWidth={stroke}
></circle>
<path
className="opacity-75"
fill="none"
strokeWidth="1"
stroke="currentColor"
d="M 0 12 a 12 12 0 0 0 19 9.745"
></path>
</svg>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment