0%
balqalam Logo
balqalam
FeaturesCommunityPricingDocumentation
Login
  • Introduction
  • Pitch
  • Hogwarts
  • Live Demo
  • MVP
  • Roadmap
  • Launch Sprint
  • PRD
  • Get Started
  • Localhost
  • Architecture
  • Structure
  • Pattern
  • Page
  • Layout
  • Content
  • Types
  • Config
  • Actions
  • Queries
  • Authorization
  • Validation
  • Form
  • Table
  • Detail
  • Card
  • Util
  • Hooks
  • List Params
  • Views
  • README.md
  • ISSUE.md
  • Technology Stack
  • Database
  • File
  • CDN Assets
  • Entry Points
  • Dashboard
  • Authentication
  • Credentials
  • OAuth
  • Flow Diagrams
  • Multi-Tenancy
  • Offline
  • Onboarding
  • Onboarding Videos
  • Add Values
  • Admission
  • Application
  • Attendance
  • Compliance
  • Profile
  • Exams
  • Exam Wizard
  • Timetable
  • Classrooms
  • Notifications
  • Conference
  • LMS (Lumos)
Finance
  • Finance
  • Fee Management
  • Invoice
  • Wallet
  • Salary
  • Payroll
  • Timesheet
  • Expenses
  • Budget
  • Receipt
  • Accounts
  • Banking
  • Reports
  • Dashboard
  • Permissions
  • Messages
  • Integration Flow
  • Provision
  • AI Document Processing
  • Document Intelligence
  • Internationalization
  • Translation
  • Translation Guide
  • Icons
  • Docs Factory
  • Inspiration
  • Listings
  • Teachers
  • Students
  • Catalog
  • Library
  • Contributing
  • Code of conduct
  • GitHub Workflow
  • Database Seeds
  • Database Safety
  • Test Accounts
  • Playwright
  • Prettier
  • Block Rebound
Sales & GTM
  • Marketing Brief
  • Sales
  • Go-to-market
  • Marketing
  • Admission — Feature Spotlight
  • Pilot Program
  • Leads
  • Proposal
  • Outreach Templates
  • Case Study
  • Competitors
  • Landing-page teardown
  • Competitor FAQ
  • Business model
  • Shared economy
  • Traction
Fundraising & Ecosystem
  • Get Support
  • Investor Deck
  • Data Room
  • Investors
  • Accelerators
  • Incubators
  • Grants
  • Sponsors
  • Partners
  • Competitions & Hackathons
  • Universities & Training Centers

Card

PreviousNext

Feature-specific display cards composed from shadcn primitives.

card.tsx renders display cards composed from shadcn Card primitives — KPIs, entity summaries, onboarding tiles. Pure presentation, no data fetching, no mutations.

Categories

CategoryShapeReference
Entity displayFull / compact / health / stats variants for one entitysaas-dashboard/billing/card.tsx
KPI / statsSingle metric with label, trend, iconschool-dashboard/dashboard/card.tsx
Onboarding stepVisual card for a wizard optiononboarding/branding/card.tsx
Atom labShowcase cards in atom/lab/atom/lab/*-card.tsx

Rules

#Rule
1Compose from shadcn Card primitives — never reinvent
2Typed entity props from types.ts — no any
3Formatters from util.ts — no inline Intl.NumberFormat
4Multiple variants per file — EntityCard, CompactCard from one card.tsx
5showActions prop for conditional footers

Canonical example

import { Badge } from "@/components/ui/badge"
import {
  Card,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
 
import type { TenantDto } from "./types"
import { formatDate } from "./util"
 
interface TenantCardProps {
  tenant: TenantDto
  showActions?: boolean
}
 
export function TenantCard({ tenant, showActions = true }: TenantCardProps) {
  return (
    <Card>
      <CardHeader>
        <CardTitle>{tenant.name}</CardTitle>
        <CardDescription>{tenant.domain}</CardDescription>
      </CardHeader>
      <CardContent>
        <Badge variant={tenant.isActive ? "default" : "secondary"}>
          {tenant.isActive ? "Active" : "Suspended"}
        </Badge>
        <p className="text-muted-foreground text-sm">
          Created {formatDate(tenant.createdAt)}
        </p>
      </CardContent>
      {showActions && <CardFooter>{/* edit, archive, etc. */}</CardFooter>}
    </Card>
  )
}
 
export function TenantCompactCard({ tenant }: { tenant: TenantDto }) {
  return (
    <Card className="bg-muted/30">
      <CardHeader>
        <CardTitle className="text-base">{tenant.name}</CardTitle>
      </CardHeader>
    </Card>
  )
}

Variant suffixes

VariantSuffixExample
Full / defaultnoneTenantCard
CompactCompactTenantCompactCard
Health / statusHealthTenantHealthCard
Metric / KPIStatsTenantStatsCard
Detail-onlyDetailTenantDetailCard

Anti-patterns

  • Form logic inside cards — 12 onboarding files do this. Lift state to client.tsx or the form.
  • Reinventing primitives — use Card, not <div className="rounded-lg border p-6">.
  • Inline formatters — Intl.NumberFormat belongs in util.ts.
  • Untyped props — import from types.ts.
  • Hardcoded labels — use the dictionary slice for translatable text.

Sibling roles

  • Rendered by content.tsx, client.tsx, or detail.tsx.
  • Imports from types.ts, util.ts, config.ts.
  • Does not import from actions.ts, queries.ts, form.tsx.
  • Does not call server actions — handlers live one level up.

Naming

  • File: card.tsx.
  • Function: <Feature>Card for default, suffix-coded variants per the table above.

See also

  • Pattern
  • Util
  • Types
  • Detail
DetailUtil

On This Page

CategoriesRulesCanonical exampleVariant suffixesAnti-patternsSibling rolesNamingSee also

Built by Databayt ·

Welcome to balqalam.

A great journey is about to begin.