# Lockness Components Reusable JSX components for server-side rendered views. ## Basic Component ```tsx // src/view/components/button.tsx export const Button = (props: { text: string; href: string }) => { return ( {props.text} ) } ``` **Usage:** ```tsx import { Button } from '@view/components/button.tsx' export const HomePage = () => { return (

Welcome

) } ``` ## Props and Types ```tsx type CardProps = { title: string description: string imageUrl?: string children?: any } export const Card = (props: CardProps) => { return (
{props.imageUrl && {props.title}}

{props.title}

{props.description}

{props.children}
) } ``` **Usage with children:** ```tsx ) } ``` **Usage:** ```tsx
``` ## Dynamic Attributes ```tsx export const Badge = (props: { text: string variant?: 'primary' | 'secondary' | 'danger' }) => { const variants = { primary: 'bg-blue-500 text-white', secondary: 'bg-gray-500 text-white', danger: 'bg-red-500 text-white', } return ( {props.text} ) } ``` ## Composition ```tsx // Card component export const Card = (props: { children: any; className?: string }) => { return (
{props.children}
) } // CardHeader component export const CardHeader = (props: { children: any }) => { return (
{props.children}
) } // CardBody component export const CardBody = (props: { children: any }) => { return
{props.children}
} // CardFooter component export const CardFooter = (props: { children: any }) => { return (
{props.children}
) } ``` **Usage:** ```tsx

Title

Content here