### Project Setup Commands
Source: https://context7.com/brijr/components/llms.txt
Commands for creating a new Next.js project, installing craft-ds (which includes shadcn/ui setup), and optional dark mode configuration.
```bash
# Step 1: Create a new Next.js project
npx create-next-app@latest my-app --typescript --tailwind --eslint
# Step 2: Install craft-ds (includes shadcn/ui setup)
npx craft-ds@latest init
# Step 3: (Optional) Add dark mode – follow shadcn/ui dark mode docs
# https://ui.shadcn.com/docs/dark-mode/next
# Step 4: Copy any component from components.work into your /components folder
# No npm install required – components are copy-paste ready
# Development
npm run dev # starts Next.js dev server on localhost:3000
npm run build # production build
npm run start # serve production build
# Environment variables
```
--------------------------------
### Initialize craft-ds
Source: https://github.com/brijr/components/blob/main/app/(mdx)/start/page.mdx
Install craft-ds, which also handles the installation of shadcn/ui. Run this command in your Next.js project directory.
```bash
npx craft-ds@latest init
```
--------------------------------
### Example Button Link Component
Source: https://github.com/brijr/components/blob/main/app/(mdx)/start/page.mdx
This React component demonstrates how to use brijr/components' Button and Next.js Link for navigation. Ensure you have the necessary imports.
```tsx
import { Button } from "@/components/ui/button";
import Link from "next/link";
```
--------------------------------
### ThemeProvider and Dark Mode Setup
Source: https://context7.com/brijr/components/llms.txt
Wraps the application with next-themes' ThemeProvider for system-aware dark/light mode. Includes a ModeToggle button to cycle themes. Components automatically adapt to the 'dark' class applied to the element.
```typescript
// app/layout.tsx – full setup
import { ThemeProvider } from "@/components/site/theme/theme-provider";
import { ModeToggle } from "@/components/site/theme/theme-toggle";
export default function RootLayout({ children }) {
return (
defaultTheme="system" // respects OS preference on first load
enableSystem
disableTransitionOnChange
>
{/* button: Sun / Moon / System icons */}
{children}
);
}
// All craft-ds components and shadcn/ui primitives respond to the "dark" class
// via Tailwind's dark: variant automatically.
```
--------------------------------
### Navigation Component Setup
Source: https://context7.com/brijr/components/llms.txt
Integrates a sticky, animated navigation bar into the root layout. The Nav component auto-hides on scroll down and reappears on scroll up, with a responsive mobile drawer.
```typescript
// components/nav.tsx
import { Nav } from "@/components/nav";
// In app/layout.tsx – place Nav above page content
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
{/* sticky top-4, hides on scroll down > 150px */}
{children}
);
}
// Nav links are defined inline — customize by editing the `links` array:
const links = [
{ name: "Heros", href: "/hero" },
{ name: "Features", href: "/feature" },
{ name: "CTAs", href: "/cta" },
{ name: "FAQs", href: "/faq" },
{ name: "Pricing", href: "/pricing" },
{ name: "Headers", href: "/header" },
{ name: "Footers", href: "/footer" },
];
// Active link: pointer-events-none + muted color (matches usePathname())
// Mobile: Sheet drawer replaces the horizontal link list below md breakpoint
```
--------------------------------
### Background Component Setup
Source: https://context7.com/brijr/components/llms.txt
Adds a fixed, full-viewport decorative background with a CSS grid dot pattern and radial gradient fade to the root layout. Placed at a low z-index to avoid content interference.
```typescript
// components/backgrounds.tsx
import { Background } from "@/components/backgrounds";
// In app/layout.tsx
export default function RootLayout({ children }) {
return (
{children}
{/* Renders:
- fixed full-screen div at z-[-50]
- bg-grid-small-black/[0.1] in light mode
- bg-grid-small-white/[0.2] in dark mode
- radial gradient overlay fades edges to transparent */}
);
}
```
--------------------------------
### FAQ Component with Collapsible Items
Source: https://context7.com/brijr/components/llms.txt
A Frequently Asked Questions component using Radix UI's Accordion. It renders collapsible items from a typed data array and supports optional external links. Ensure 'lucide-react' is installed for icons.
```tsx
// components/faqs/faqs-one.tsx
import { Section, Container } from "@/components/craft";
import { ArrowUpRight } from "lucide-react";
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion";
type FAQItem = { question: string; answer: string; link?: string };
const content: FAQItem[] = [
{
question: "How do I install these components?",
answer: "Copy the component file into your project's components folder. Make sure craft.tsx and shadcn/ui are set up first.",
link: "https://github.com/brijr/components",
},
{
question: "Do I need to install any dependencies?",
answer: "Run `npx craft-ds@latest init` to install craft-ds which includes shadcn/ui and Tailwind CSS configuration.",
},
{
question: "Are the components accessible?",
answer: "Yes — all interactive components are built on Radix UI primitives, which are fully accessible by default.",
},
];
const FAQ = () => (
Frequently Asked Questions
Can't find the answer? Reach out to our support team.
);
export default FAQ;
```
--------------------------------
### Minimal Button CTA Component
Source: https://context7.com/brijr/components/llms.txt
A basic Call to Action component with text and two buttons. Ensure 'react-wrap-balancer' is installed for text balancing.
```tsx
// components/ctas/cta-one.tsx – minimal button CTA
import { Section, Container } from "@/components/craft";
import { Button } from "@/components/ui/button";
import Link from "next/link";
import Balancer from "react-wrap-balancer";
const CTA = () => (
Ready to get started?
Join thousands of developers building faster with brijr/components.
);
```
--------------------------------
### CTA Component with Email Form Capture
Source: https://context7.com/brijr/components/llms.txt
A CTA component featuring an inline email capture form. It uses Zod for schema validation and react-hook-form for form management. Ensure 'zod' and '@hookform/resolvers' are installed.
```tsx
// components/ctas/cta-two.tsx – CTA with email form capture
"use client";
import * as z from "zod";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
import { Input } from "@/components/ui/input";
const formSchema = z.object({
email: z.string().email({ message: "Please enter a valid email address." }),
});
export function CTA() {
const form = useForm>({
resolver: zodResolver(formSchema),
defaultValues: { email: "" },
});
function onSubmit(values: z.infer) {
console.log(values); // { email: "user@example.com" }
}
return (
Stay in the loop!
);
}
```
--------------------------------
### Initialize Next.js App with shadcn/ui
Source: https://github.com/brijr/components/blob/main/README.md
Run this command to set up a new Next.js application and integrate shadcn/ui. This is the first step to using the brijr/components.
```bash
pnpx shadcn@latest init
```
--------------------------------
### Create a Next.js Application
Source: https://github.com/brijr/components/blob/main/app/(mdx)/start/page.mdx
Use this command to scaffold a new Next.js project with TypeScript, Tailwind CSS, and ESLint support.
```bash
npx create-next-app@latest my-app --typescript --tailwind --eslint
```
--------------------------------
### Responsive Grid Layout with Box Component
Source: https://context7.com/brijr/components/llms.txt
Demonstrates using the `Box` component to create a responsive grid layout. The number of columns adjusts based on screen size, with configurable gaps.
```tsx
// Box – responsive grid
export function GridLayout() {
return (
Card 1
Card 2
Card 3
);
}
```
--------------------------------
### ThemeProvider & Dark Mode
Source: https://context7.com/brijr/components/llms.txt
Wraps the application with `next-themes`' `ThemeProvider` to enable system-aware dark/light mode. A `ModeToggle` button allows users to cycle through themes.
```APIDOC
## ThemeProvider & Dark Mode (`components/site/theme/`)
### Description
Wraps the app with `next-themes`' `ThemeProvider` for system-aware dark/light mode. A `ModeToggle` button cycles between light, dark, and system themes.
### Usage
Set up `ThemeProvider` and `ModeToggle` in your `app/layout.tsx`.
```tsx
// app/layout.tsx – full setup
import { ThemeProvider } from "@/components/site/theme/theme-provider";
import { ModeToggle } from "@/components/site/theme/theme-toggle";
export default function RootLayout({ children }) {
return (
defaultTheme="system" // respects OS preference on first load
enableSystem
disableTransitionOnChange
>
{/* button: Sun / Moon / System icons */}
{children}
);
}
```
### Features
- **`ThemeProvider`**: Manages theme state using `next-themes`.
- `attribute="class"`: Applies the `dark` class to the `` element.
- `defaultTheme="system"`: Sets the initial theme based on the operating system preference.
- `enableSystem`: Enables system theme detection.
- `disableTransitionOnChange`: Disables transitions when the theme changes.
- **`ModeToggle`**: A button component that allows users to switch between light, dark, and system themes.
- **Automatic Styling**: All components using Tailwind CSS's `dark:` variant will automatically adapt to the selected theme.
```
--------------------------------
### Configure API Key for Loops.so Integration
Source: https://context7.com/brijr/components/llms.txt
Set the LOOPS_API_KEY in your .env.local file to enable the /api/subscribe endpoint for email capture.
```dotenv
LOOPS_API_KEY=your_loops_api_key_here # required for /api/subscribe
```
--------------------------------
### Static 3-Tier Pricing Grid (React)
Source: https://context7.com/brijr/components/llms.txt
Renders a static 3-tier pricing grid using a typed data array. Ensure all necessary UI components and icons are imported.
```tsx
// components/pricing/pricing-one.tsx – static 3-tier pricing
import { Section, Container } from "../craft";
import { Button } from "../ui/button";
import { Badge } from "../ui/badge";
import { CircleCheck } from "lucide-react";
import Link from "next/link";
interface PricingCardProps {
title: "Basic" | "Standard" | "Pro";
price: string;
description?: string;
features: string[];
cta: string;
href: string;
}
const pricingData: PricingCardProps[] = [
{ title: "Basic", price: "$29/month", description: "For individuals.", features: ["3 Pages", "Basic SEO", "Email Support"], cta: "Choose Basic", href: "https://stripe.com/" },
{ title: "Standard", price: "$59/month", description: "For growing teams.", features: ["10 Pages", "Advanced SEO", "CMS Integration", "24/7 Support"], cta: "Choose Standard", href: "https://stripe.com/" },
{ title: "Pro", price: "$99/month", description: "For large businesses.", features: ["Unlimited Pages", "E-commerce", "Priority Support", "Custom API"], cta: "Choose Pro", href: "https://stripe.com/" },
];
const PricingCard = ({ plan }: { plan: PricingCardProps }) => (
{plan.title}
{plan.price}
{plan.description}
{plan.features.map((feature, i) => (
{feature}
))}
);
```
--------------------------------
### Responsive Flex Row with Box Component
Source: https://context7.com/brijr/components/llms.txt
Shows how to use the `Box` component for creating responsive flex rows. Adapts from a single column on small screens to a row on medium screens, with wrapping enabled.
```tsx
// Box – responsive flex row
export function FlexRow() {
return (
Item 1
Item 2
Item 3
);
}
```
--------------------------------
### Full Page Layout Shell with Craft-DS
Source: https://context7.com/brijr/components/llms.txt
Demonstrates the root layout structure using Brijr's `Layout` and `Main` components for a full-page shell. Applies custom fonts and basic body structure.
```tsx
// components/craft.tsx
import { Layout, Main, Section, Container, Article, Box } from "@/components/craft";
// Full page layout shell
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
{children}
);
}
```
--------------------------------
### Typical Page Section Structure with Craft-DS
Source: https://context7.com/brijr/components/llms.txt
Illustrates a standard page section using `Section`, `Container`, `h2`, and `p` from Brijr's `craft-ds`. Suitable for organizing content within a page.
```tsx
// Typical page section structure
export function PageSection() {
return (
Section Title
Section content goes here.
);
}
```
--------------------------------
### Background Component
Source: https://context7.com/brijr/components/llms.txt
A fixed, full-viewport decorative background with a CSS grid dot pattern and a radial gradient fade. It is positioned at a low z-index to avoid interfering with content.
```APIDOC
## Background Component (`components/backgrounds.tsx`)
### Description
A fixed full-viewport decorative background using a CSS grid dot pattern with a radial gradient fade. Placed at `z-index: -50` so it never interferes with content.
### Usage
Include the `Background` component in your `app/layout.tsx` file.
```tsx
// In app/layout.tsx
import { Background } from "@/components/backgrounds";
export default function RootLayout({ children }) {
return (
{children}
);
}
```
### Features
- Fixed full-screen positioning
- CSS grid dot pattern
- Radial gradient overlay fades edges to transparent
- `z-index: -50` to ensure it stays behind content
- Adapts grid color based on theme (light/dark mode)
```
--------------------------------
### Left-Aligned Hero with Badge Link and Image
Source: https://context7.com/brijr/components/llms.txt
Use this component for a left-aligned hero section featuring a badge link, a prominent heading, a subheading, and a full-width image. It utilizes Next.js Image, Lucide React icons, and components from craft-ds and shadcn/ui.
```tsx
// components/heros/hero-one.tsx – left-aligned hero with image
import Image from "next/image";
import Link from "next/link";
import Balancer from "react-wrap-balancer";
import { ArrowRight } from "lucide-react";
import { Section, Container } from "@/components/craft";
import { Button } from "@/components/ui/button";
import Placeholder from "@/public/placeholder.jpg";
const Hero = () => (
Your compelling headline goes here
Your product description. Keep it short — one or two sentences that describe the value.
);
export default Hero;
```
--------------------------------
### Nav Component
Source: https://context7.com/brijr/components/llms.txt
A sticky, animated navigation bar that auto-hides on scroll down and reappears on scroll up. It includes desktop links, a dark/light mode toggle, a GitHub link, and a responsive mobile drawer.
```APIDOC
## Nav Component (`components/nav.tsx`)
### Description
A sticky, animated navigation bar using Framer Motion that auto-hides on scroll down and reappears on scroll up (after 150px threshold). Includes a desktop link list, dark/light mode toggle, GitHub link, and a responsive mobile `Sheet` drawer.
### Usage
Place the `Nav` component above the page content in your `app/layout.tsx` file.
```tsx
// In app/layout.tsx – place Nav above page content
import { Nav } from "@/components/nav";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
{/* sticky top-4, hides on scroll down > 150px */}
{children}
);
}
```
### Customization
Nav links are defined inline within the component. Customize them by editing the `links` array:
```javascript
const links = [
{ name: "Heros", href: "/hero" },
{ name: "Features", href: "/feature" },
{ name: "CTAs", href: "/cta" },
{ name: "FAQs", href: "/faq" },
{ name: "Pricing", href: "/pricing" },
{ name: "Headers", href: "/header" },
{ name: "Footers", href: "/footer" },
];
```
### Features
- Sticky positioning
- Auto-hides on scroll down (> 150px threshold)
- Reappears on scroll up
- Desktop link list
- Dark/light mode toggle
- GitHub link
- Responsive mobile `Sheet` drawer
```
--------------------------------
### Monthly/Yearly Billing Toggle (React)
Source: https://context7.com/brijr/components/llms.txt
Implements a monthly/yearly billing toggle using shadcn/ui Tabs. Requires state management for the selected billing period. The 'Save 17%' badge is applied to the yearly option.
```tsx
// components/pricing/pricing-two.tsx – with monthly/yearly toggle
"use client";
import { useState } from "react";
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
const Pricing2 = () => {
const [billingPeriod, setBillingPeriod] = useState<"monthly" | "yearly">("monthly");
return (
Pricing
setBillingPeriod(v as "monthly" | "yearly")} className="w-[300px]">
Monthly
Yearly
Save 17%
{/* PricingCard receives billingPeriod and renders monthlyPrice or yearlyPrice */}
);
};
```
--------------------------------
### 3-Column Icon Grid Feature Component
Source: https://context7.com/brijr/components/llms.txt
Use this component for a 3-column layout displaying icons, titles, and descriptions. It requires importing `Section` and `Container` from '@/components/craft', and icons from 'lucide-react'.
```tsx
// components/features/feature-one.tsx – 3-column icon grid
import { Section, Container } from "@/components/craft";
import { Zap, Shield, Globe } from "lucide-react";
type FeatureText = { icon: JSX.Element; title: string; description: string };
const featureText: FeatureText[] = [
{ icon: , title: "Fast", description: "Optimized for performance from day one." },
{ icon: , title: "Secure", description: "Enterprise-grade security built in." },
{ icon: , title: "Global", description: "Deploy to any region in seconds." },
];
const Feature = () => (
);
```
--------------------------------
### Subscribe API Route
Source: https://context7.com/brijr/components/llms.txt
A Next.js App Router POST handler to create a contact in Loops.so. It accepts email, source, and userGroup in the request body and uses the LOOPS_API_KEY environment variable for authentication.
```APIDOC
## POST /api/subscribe
### Description
Creates a contact in Loops.so.
### Method
POST
### Endpoint
/api/subscribe
### Parameters
#### Request Body
- **email** (string) - Required - The email address of the contact.
- **source** (string) - Optional - The source URL where the contact originated.
- **userGroup** (string) - Optional - The user group the contact belongs to.
### Request Example
```json
{
"email": "user@example.com",
"source": "https://yoursite.com/landing",
"userGroup": "Beta"
}
```
### Response
#### Success Response (201)
- **success** (boolean) - Indicates if the operation was successful.
- **id** (string) - The ID of the created contact.
#### Error Response (400)
- **error** (string) - Message indicating that the email is required.
#### Error Response (500)
- **error** (string) - Message indicating an API configuration error or internal server error.
### Example fetch call:
```javascript
const response = await fetch("/api/subscribe", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
email: "user@example.com",
source: "https://yoursite.com/landing",
userGroup: "Beta",
}),
});
const data = await response.json();
```
### curl equivalent:
```bash
curl -X POST https://yoursite.com/api/subscribe \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","source":"landing","userGroup":"Beta"}'
```
```
--------------------------------
### Comprehensive Footer with Subscription Form
Source: https://context7.com/brijr/components/llms.txt
A footer component including logo, description, social links, an email subscription form using Zod and react-hook-form, and legal links. The form submits to the '/api/subscribe' route.
```tsx
"use client";
import * as z from "zod";
import Image from "next/image";
import Link from "next/link";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { Github, Twitter, Facebook } from "lucide-react";
import Logo from "@/public/logo.svg";
import { Section, Container } from "../craft";
import { Button } from "../ui/button";
import { Input } from "@/components/ui/input";
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
const formSchema = z.object({
email: z.string().email({ message: "Please enter a valid email address." }),
});
export default function Footer() {
const form = useForm>({
resolver: zodResolver(formSchema),
defaultValues: { email: "" },
});
async function onSubmit(values: z.infer) {
await fetch("/api/subscribe", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email: values.email, source: "footer", userGroup: "Newsletter" }),
});
}
return (
);
}
```
--------------------------------
### Subscribe API Route
Source: https://context7.com/brijr/components/llms.txt
A Next.js App Router POST handler for creating contacts in Loops.so. Requires the LOOPS_API_KEY environment variable. Accepts email, source, and userGroup in the request body.
```typescript
// app/api/subscribe/route.ts
// Environment: LOOPS_API_KEY=your_loops_api_key
// POST /api/subscribe
// Request body: { email: string, source?: string, userGroup?: string }
// Response 201: { success: true, id: string }
// Response 400: { error: "Email is required" }
// Response 500: { error: "API configuration error" | "Internal Server Error" }
// Example fetch call:
const response = await fetch("/api/subscribe", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
email: "user@example.com",
source: "https://yoursite.com/landing",
userGroup: "Beta",
}),
});
const data = await response.json();
// Success: { success: true, id: "contact_abc123" }
// Error: { error: "Email is required" }
// curl equivalent:
// curl -X POST https://yoursite.com/api/subscribe \
// -H "Content-Type: application/json" \
// -d '{"email":"user@example.com","source":"landing","userGroup":"Beta"}'
```
--------------------------------
### 2-Column Text and Image Feature Component
Source: https://context7.com/brijr/components/llms.txt
This component is suitable for a 2-column layout featuring text on one side and an image on the other. It requires `Section` and `Container` from '@/components/craft', and `Button` and `Link` components, along with an `Image` component and a placeholder image.
```tsx
// components/features/feature-four.tsx – 2-column text + image
const FeatureSplit = () => (
A feature worth highlighting
Describe the benefit in one or two sentences. Focus on the outcome for your customer.
);
```
--------------------------------
### Centered Hero with Logo and Dual CTA Buttons
Source: https://context7.com/brijr/components/llms.txt
This component renders a centered hero section with a company logo above the heading and two call-to-action buttons below. It's suitable for scenarios requiring a prominent brand presence and clear user engagement points. Includes imports for Next.js Image, Lucide React icons, and components from craft-ds and shadcn/ui.
```tsx
// components/heros/hero-two.tsx – centered hero with logo + dual CTA
import Logo from "@/public/logo.svg";
import { Camera } from "lucide-react";
const Hero2 = () => (
Your headline for a centered hero
Supporting description text that explains what you do.
);
```
--------------------------------
### Animated Email Subscription Form
Source: https://context7.com/brijr/components/llms.txt
An animated client-side email capture form with Framer Motion transitions, Zod validation, and states for loading and success. It POSTs to '/api/subscribe' and displays a 'Thank you' message upon successful submission.
```tsx
"use client";
import { EmailForm } from "@/components/email-form";
// Usage: drop onto any page or hero section
export default function Page() {
return (
Get early access
{/* On submit: POSTs { email, source, userGroup } to /api/subscribe */}
{/* On success: animates to "Thank you for subscribing." */}
{/* On error: shows "Failed to subscribe. Please try again." inline */}
);
}
// Internal behavior summary:
// - Zod schema: z.object({ email: z.string().email() })
// - POST /api/subscribe with { email, source: "https://components.work", userGroup: "Components" }
// - Framer Motion AnimatePresence swaps form ↔ thank-you message
// - useMeasure animates container height change smoothly
```
--------------------------------
### Safe Tailwind Class Merging with cn()
Source: https://context7.com/brijr/components/llms.txt
Illustrates the usage of the `cn()` utility function for safely merging Tailwind CSS classes. Handles conditional classes and ensures correct class concatenation.
```tsx
// cn() utility – merges Tailwind classes safely
import { cn } from "@/components/craft";
const className = cn("px-4 py-2", isActive && "bg-primary text-white", "rounded-md");
```
--------------------------------
### Clean Header Block (React)
Source: https://context7.com/brijr/components/llms.txt
A clean page-header block with an H1 title, a descriptive subheading using react-wrap-balancer for text wrapping, and two action buttons. Ensure 'craft' components and UI button are imported.
```tsx
// components/headers/header-one.tsx
import Balancer from "react-wrap-balancer";
import { Button } from "../ui/button";
import { Container, Section } from "@/components/craft";
const Header = () => (
Your Page Title Here
A short, punchy description of this page or feature set.
);
export default Header;
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.