Login Button - Login CTA button
A login action button with an optional icon and default Log in label, matching shadcn/ui button variants.
components/shadcnblocks/login-button.tsx
import { Slot } from "radix-ui";
import { LogIn } from "lucide-react";
import { cn } from "cn";
import { buttonVariants } from "@/components/ui/button";
type LoginButtonVariant =
| "default"
| "secondary"
| "outline"
| "ghost"
| "link";
export interface LoginButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
variant?: LoginButtonVariant;
showIcon?: boolean;
asChild?: boolean;
}
export const LoginButton = ({
variant = "default",
showIcon = true,
asChild = false,
children = "Log in",
className,
...props
}: LoginButtonProps) => {
const Comp = asChild ? Slot.Root : "button";
return (
<Comp
type={asChild ? undefined : "button"}
className={cn(buttonVariants({ variant, size: "default" }), "gap-2", className)}
{...props}
>
{showIcon && <LogIn className="size-4" />}
{children}
</Comp>
);
};
- Where it goes
- ctalogin
- Use cases
- saas-landing
More from ShadcnBlocks
About 1 - Intro With Story ColumnsblockAbout 10 - Sticky Sidebar Company ProfileblockAbout 11 - Creative Agency PortfolioblockAbout 12 - Agency Profile with Process CardsblockAbout 13 - Story with Avatar ProfileblockAbout 14 - About with Hero ImageblockAbout 15 - Tilted Photo Profile CardblockAbout 16 - Why Us Stats Sectionblock
Browse all components in this library →