New Loading Spinner Component #1694
Replies: 8 comments 10 replies
-
Agreed, this seems to be something missing! |
Beta Was this translation helpful? Give feedback.
-
export const LoadingSpinner = ({className}) => {
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className={cn("animate-spin", className)}
>
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
</svg>
} |
Beta Was this translation helpful? Give feedback.
-
@benjick is shared a good example. I improved a bit and add type-safety and flexibility. export interface ISVGProps extends React.SVGProps<SVGSVGElement> {
size?: number;
className?: string;
}
export const LoadingSpinner = ({
size = 24,
className,
...props
}: ISVGProps) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
{...props}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className={cn("animate-spin", className)}
>
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
</svg>
);
}; |
Beta Was this translation helpful? Give feedback.
-
how can i use this loadingspinner |
Beta Was this translation helpful? Give feedback.
-
take a look at lucide-react package. it is as simple as: import { LoaderIcon } from "lucide-react"
<LoaderIcon className="animate-spin" /> |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
created it here |
Beta Was this translation helpful? Give feedback.
-
A component that indicates interface loading would be interesting, I know Skeleton already exists, but that's not what I'm talking about. It's something like a spinner.
I know this isn't a big deal and it doesn't take much work for me to do myself, but I like shadcn/ui's design patterns and I would love it to have that.
An example:
Beta Was this translation helpful? Give feedback.
All reactions