Skip to content

Commit efbedcc

Browse files
committed
adding remember me checkbox
1 parent 2e45120 commit efbedcc

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed

package-lock.json

Lines changed: 72 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"dependencies": {
3838
"@headlessui/react": "^2.2.0",
3939
"@radix-ui/react-avatar": "^1.1.2",
40+
"@radix-ui/react-checkbox": "^1.1.4",
4041
"@radix-ui/react-collapsible": "^1.1.2",
4142
"@radix-ui/react-dialog": "^1.1.4",
4243
"@radix-ui/react-dropdown-menu": "^2.1.4",
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import * as React from "react"
2+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
3+
import { Check } from "lucide-react"
4+
5+
import { cn } from "@/lib/utils"
6+
7+
const Checkbox = React.forwardRef<
8+
React.ElementRef<typeof CheckboxPrimitive.Root>,
9+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
10+
>(({ className, ...props }, ref) => (
11+
<CheckboxPrimitive.Root
12+
ref={ref}
13+
className={cn(
14+
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
15+
className
16+
)}
17+
{...props}
18+
>
19+
<CheckboxPrimitive.Indicator
20+
className={cn("flex items-center justify-center text-current")}
21+
>
22+
<Check className="h-4 w-4" />
23+
</CheckboxPrimitive.Indicator>
24+
</CheckboxPrimitive.Root>
25+
))
26+
Checkbox.displayName = CheckboxPrimitive.Root.displayName
27+
28+
export { Checkbox }

resources/js/pages/auth/login.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { FormEventHandler } from 'react';
55
import InputError from '@/components/input-error';
66
import TextLink from '@/components/text-link';
77
import { Button } from '@/components/ui/button';
8+
import { Checkbox } from '@/components/ui/checkbox';
89
import { Input } from '@/components/ui/input';
910
import { Label } from '@/components/ui/label';
1011
import AuthLayout from '@/layouts/auth-layout';
@@ -78,6 +79,12 @@ export default function Login({ status, canResetPassword }: LoginProps) {
7879
<InputError message={errors.password} />
7980
</div>
8081

82+
{/* Uncomment below to display 'remember me' checkbox */}
83+
{/* <div className="flex items-center space-x-1.5">
84+
<Checkbox id="remember" name="remember" />
85+
<Label htmlFor="remember">Remember me</Label>
86+
</div> */}
87+
8188
<Button type="submit" className="w-full" tabIndex={3} disabled={processing}>
8289
{processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
8390
Log In

0 commit comments

Comments
 (0)