@forgeframework/design-system
v0.4.0
Published
Complete component library based on shadcn/ui for the Forge Framework.
Downloads
885
Maintainers
Readme
@forgeframework/design-system
Complete component library based on shadcn/ui for the Forge Framework.
Part of the Forge Framework — a TypeScript framework for backend microservices and web applications.
Installation
npm install @forgeframework/design-systemUsage
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import * as z from 'zod';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card';
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form';
import { Input } from '@/components/ui/input';
import { cn } from '@/lib/utils';
const loginSchema = z.object({
email: z.string().email(),
password: z.string().min(8),
});
type LoginValues = z.infer<typeof loginSchema>;
function LoginCard({ className }: { className?: string }) {
const form = useForm<LoginValues>({
resolver: zodResolver(loginSchema),
defaultValues: { email: '', password: '' },
});
return (
<Card className={cn('w-[380px]', className)}>
<CardHeader>
<CardTitle>Sign In</CardTitle>
<CardDescription>Enter your credentials to access your account.</CardDescription>
</CardHeader>
<Form form={form} onSubmit={form.handleSubmit((v) => console.log(v))}>
<CardContent className="space-y-4">
<FormField control={form.control} name="email" render={({ field }) => (
<FormItem>
<FormLabel>Email</FormLabel>
<FormControl><Input type="email" placeholder="[email protected]" {...field} /></FormControl>
<FormMessage />
</FormItem>
)} />
<FormField control={form.control} name="password" render={({ field }) => (
<FormItem>
<FormLabel>Password</FormLabel>
<FormControl><Input type="password" {...field} /></FormControl>
<FormMessage />
</FormItem>
)} />
</CardContent>
<CardFooter>
<Button type="submit" className="w-full">Sign In</Button>
</CardFooter>
</Form>
</Card>
);
}Documentation
Full API reference and guides: https://carbonforge.io/framework/docs/design/design-system
(Documentation site launching soon.)
License
MIT © Carbon Forge
