Skip to main content

Overview

Relevant source files This document introduces @ui8kit/core, a minimalist React UI component library built on utility-first Tailwind CSS and semantic HTML5. It covers the design philosophy, architectural layers, component inventory, variant system, and integration methods. For installation instructions and setup, see Getting Started.
For detailed architectural descriptions, see Architecture.
For complete API documentation, see API Reference.
Sources: .devin/wiki.json24-33 README.md1-10

Purpose and Scope

@ui8kit/core is a production-ready React component library designed to enable rapid interface development with minimal code. The library provides 23 total components organized in three architectural layers, styled through 12 composable CVA-based variants that eliminate the need for manual className management in ~80% of use cases. Target Audience: React developers building applications with Tailwind CSS who prioritize:
  • Minimal bundle size and code footprint
  • Type-safe component APIs with TypeScript
  • Semantic HTML5 for accessibility and SEO
  • Flexible composition patterns without rigid design constraints
What This Library Provides:
  • 5 core primitive components (Layer 1) for foundational layouts
  • 15 UI composite components (Layer 2) for common interface patterns
  • 3 layout template components (Layer 3) for application structures
  • 12 reusable variant categories covering spacing, colors, layout, typography, and effects
  • Multiple integration methods: NPM package, per-component installation, git submodule, direct source
What This Library Does Not Provide:
  • Opinionated design system with fixed visual style
  • Form validation or state management
  • Animation framework
  • Icon library (depends on lucide-react for icons in specific components)
Sources: package.json1-20 README.md3-19 .devin/wiki.json2-10

Design Philosophy

The library is built on the principle of minimal code with maximum flexibility. Complex interfaces emerge from composing a small set of primitives rather than assembling dozens of specialized components.

Core Principles

PrincipleImplementationBenefit
Minimalism15 UI components vs. 50+ in typical librariesReduced bundle size, faster learning curve
80/20 Coverage12 variants cover ~80% of styling needsEliminates most manual className usage
ComposabilityPrimitives combine to create unlimited designsNo rigid design constraints
Type SafetyFull TypeScript support with prop interfacesPrevents runtime prop errors
Semantic HTMLComponents render as <section>, <article>, <nav>, etc.Better accessibility and SEO
Zero Runtime OverheadCVA generates static Tailwind classes at build timeNo runtime style calculation

Minimalism in Practice

The library achieves interface complexity through composition rather than component proliferation:
// Traditional approach: specialized form components
<Form>
  <FormField>
    <FormLabel>Email</FormLabel>
    <FormInput type="email" />
    <FormError>Invalid email</FormError>
  </FormField>
</Form>

// @ui8kit/core approach: compose primitives
<Block component="form" p="lg" rounded="md" bg="card">
  <Stack gap="md">
    <Box>
      <Text weight="medium" mb="xs">Email</Text>
      <Box component="input" type="email" w="full" border="1px solid border" />
      <Text size="sm" c="destructive">Invalid email</Text>
    </Box>
  </Stack>
</Block>
Both achieve the same result, but the primitive approach:
  • Eliminates 4 specialized components from the bundle
  • Provides full styling control through variants
  • Maintains semantic HTML with component="form" and component="input"
  • Requires no additional component learning curve
Sources: README.md388-403 .devin/wiki.json7-10 src/components/GUIDE_CREATE_FORM.md1-100

Component Architecture

Variant System (src/core/variants/)

Layer 1: Core Primitives (src/core/ui/)

Layer 2: UI Components (src/components/ui/)

Layer 3: Layout Templates (src/layouts/)

uses

uses

uses

extends

extends

uses

applies

applies

applies

prop forwarding

prop forwarding

DashLayout.tsx
Dashboard with sidebar/header

LayoutBlock.tsx
Content sections

SplitBlock.tsx
Two-column layouts

button.tsx
Action buttons

card.tsx
+ Card.Header/Content/Footer

text.tsx
Semantic text

title.tsx
h1-h6 headings

badge.tsx
Labels

icon.tsx
SVG wrapper

image.tsx
Optimized images

container.tsx
Max-width container

group.tsx
Element grouping

sheet.tsx
Drawer component

accordion.tsx
Expandable sections

Block.tsx
Semantic container

Box.tsx
Flexible primitive

Grid.tsx
CSS Grid layout

Flex.tsx
Flexbox layout

Stack.tsx
Vertical/horizontal stacking

spacing-variants.ts
p, m, px, py, mx, my, etc.

color-variants.ts
bg, c, borderColor

layout-variants.ts
w, h, position

typography-variants.ts
size, weight, align

effect-variants.ts
shadow, rounded, border
Architecture: Three-Layer Component Hierarchy The library implements a strict three-layer hierarchy aligned with atomic design principles:

Layer 1: Core Primitives (src/core/ui/)

Five foundational components that directly apply the variant system:
ComponentFilePurposeVariants Applied
BlockBlock.tsxSemantic container (section, article, nav, etc.)All 12 variants
BoxBox.tsxGeneric flexible primitive (any HTML element)All 12 variants
GridGrid.tsxCSS Grid layout with cols and rows propsSpacing, layout variants
FlexFlex.tsxFlexbox layout with direction and justify propsSpacing, layout variants
StackStack.tsxVertical/horizontal stacking with gap propSpacing variants
These primitives provide the foundation for all higher-layer components. They render semantic HTML5 elements and accept variant props directly.

Layer 2: UI Components (src/components/ui/)

Fifteen composite components that extend primitives through prop forwarding:
ComponentFileBase PrimitiveSpecial Features
Buttonbutton.tsxBoxvariant, size, leftSection, rightSection
Cardcard.tsxBlockCompound: Card.Header, Card.Content, Card.Footer
Texttext.tsxBoxSemantic tags: p, span, em, strong
Titletitle.tsxBoxHeading hierarchy: h1-h6 via order prop
Badgebadge.tsxBoxSmall label with variant
Iconicon.tsxBoxSVG wrapper with size control
Imageimage.tsxBoxOptimized with alt and loading props
Containercontainer.tsxBlockResponsive max-width: sm, md, lg, xl, 2xl
Groupgroup.tsxFlexElement grouping with gap
Sheetsheet.tsxN/ADrawer with side prop (uses lucide-react)
Accordionaccordion.tsxN/AExpandable sections (uses lucide-react)
These components inherit all variant props from their base primitives while adding component-specific props.

Layer 3: Layout Templates (src/layouts/)

Three template components that orchestrate Layer 2 components into application structures:
ComponentFilePurposeDependencies
DashLayoutDashLayout.tsxDashboard with resizable sidebar, header, contentreact-resizable-panels
LayoutBlockLayoutBlock.tsxContent section with beforeContent/content/afterContent hooksGrid
SplitBlockSplitBlock.tsxTwo-column layout (media + content or content + media)Container
Sources: README.md62-168 src/core/ui/Block.tsx1-50 src/core/ui/Box.tsx1-40 src/components/ui/button.tsx1-100 src/components/ui/card.tsx1-150 src/layouts/DashLayout.tsx1-100

Variant System Overview

Output

Build Artifact

CVA Engine

Variant Files (src/core/variants/)

Developer API

generates

generates

safelist for

Component JSX
p='lg' rounded='xl'
shadow='md' bg='card'

spacing-variants.ts
spacingVariants

color-variants.ts
colorVariants

layout-variants.ts
layoutVariants

typography-variants.ts
typographyVariants

effect-variants.ts
effectVariants

class-variance-authority
cva() function

Generated Classes
p-8 rounded-xl shadow-md
bg-card

src/lib/core-classes.json
618 class whitelist

HTML Element
with Tailwind classes

Tailwind CSS Purge
Variant System: CVA-Based Styling Pipeline The variant system centralizes all styling logic through 12 composable variant categories, eliminating the need for manual className management in most scenarios.

Variant Categories

CategoryPropsValuesFile
Spacingp, m, px, py, pt, pb, pl, pr, mx, my, mt, mb, ml, mrnone, xs, sm, md, lg, xl, 2xl, autospacing-variants.ts
Colorsbg, c, borderColorDesign system colors: primary, secondary, destructive, card, foreground, etc.color-variants.ts
Layoutw, h, minH, maxW, positionauto, full, screen, fit, min, maxlayout-variants.ts
Typographysize, weight, align, leadingFont sizes: xs, sm, md, lg, xl, 2xl, 3xl; weights: normal, medium, boldtypography-variants.ts
Effectsrounded, shadow, borderCorner radius, shadow depth, border styleseffect-variants.ts
Flexboxdirection, justify, items, wrap, gapFlexbox propertiesIntegrated in layout variants
Gridcols, rows, gapCSS Grid propertiesIntegrated in layout variants

Variant Application Flow

  1. Developer writes variant props in JSX: <Card p="lg" rounded="xl" shadow="md" bg="card" />
  2. CVA engine resolves props to Tailwind classes via cva() function from class-variance-authority
  3. Generated classes output: p-8 rounded-xl shadow-md bg-card
  4. Whitelist validation ensures Tailwind purge doesn’t remove necessary classes (618 classes in core-classes.json)
  5. DOM renders with final class string applied

Build-Time Class Extraction

The scripts/cva-extractor.ts script scans all variant files and generates src/lib/core-classes.json:
{
  "classes": [
    "p-0", "p-1", "p-2", "p-4", "p-6", "p-8", "p-12", "p-16",
    "m-0", "m-1", "m-2", "m-4", "m-6", "m-8", "m-12", "m-16",
    "bg-primary", "bg-secondary", "bg-card", "bg-background",
    "rounded-none", "rounded-sm", "rounded-md", "rounded-lg", "rounded-xl",
    // ... 618 total classes
  ]
}
This whitelist serves two purposes:
  • Tailwind safelist - prevents CSS purge from removing variant classes
  • tw-merge safety - ensures class merging works correctly
Sources: README.md170-217 src/core/variants/spacing-variants.ts1-100 src/core/variants/color-variants.ts1-80 scripts/cva-extractor.ts1-260 src/lib/core-classes.json1-619

Technology Stack

Core Dependencies

PackageVersionPurposeUsage
react^18.0.0 or ^19.0.0UI frameworkPeer dependency (provided by consumer)
react-dom^18.0.0 or ^19.0.0React renderingPeer dependency (provided by consumer)
class-variance-authority^0.7.1Variant enginePowers the 12 variant categories
clsx^2.1.1Class concatenationUtility for merging class strings
tailwind-merge^3.3.1Class deduplicationPrevents duplicate Tailwind classes
lucide-react^0.525.0Icon libraryUsed in Sheet and Accordion components
react-resizable-panels^3.0.6Resizable layoutsUsed in DashLayout for sidebar resizing

Build Tools

ToolPurposeConfiguration
TypeScriptType checking and compilationtsconfig.json with ES2022 target
ESLintCode quality.eslintrc with TypeScript rules
BunPackage manager and runtimebun-types for TypeScript support
cva-extractor.tsBuild-time class extractionGenerates core-classes.json whitelist
buildy-ui CLIComponent registry scannerGenerates registry.json metadata

Distribution Format

The library distributes as ES2022 modules with TypeScript declarations:
ArtifactPathPurpose
Main entrydist/index.jsES2022 module exports
Type definitionsdist/index.d.tsTypeScript interface declarations
Class whitelistsrc/lib/core-classes.jsonTailwind safelist (618 classes)
Component registrysrc/registry.jsonMetadata for per-component installation
Export Configuration in package.json33-37:
{
  "exports": {
    ".": {
      "import": "./dist/index.js",
      "types": "./dist/index.d.ts"
    }
  }
}
Sources: package.json48-69 package.json30-37 README.md422-440

Integration Methods

Integration Method 5: Programmatic

Integration Method 4: Direct Source

Integration Method 3: Git Submodule

Integration Method 2: Per-Component

Integration Method 1: Full Library

Distribution Channels

Source Repository

github.com/ui8kit/core

src/registry.json
Component metadata

NPM Registry
@ui8kit/Unsupported markdown: link

Git Repository
main branch

npm install @ui8kit/core

import { Button, Card } from '@ui8kit/core'

npx buildy-ui add button card

components/ui/button.tsx
components/ui/card.tsx

git submodule add
Unsupported markdown: link
packages/@ui8kit/core

import { Button } from '@ui8kit/core'

Copy src/ directory

Custom build process

import registry from
'@ui8kit/core/registry.json'

Tooling automation
Integration Methods: Five Approaches The library supports five distinct integration methods to accommodate different development workflows:

Method 1: Full Library Installation (NPM)

Use Case: Standard application development with all components available
npm install @ui8kit/core react react-dom
Imports:
import { Button, Card, Text, Stack, Grid } from '@ui8kit/core';
Bundle Size: Full library (~15 UI components + 3 layouts + 5 primitives) Advantages:
  • Single dependency declaration
  • All components immediately available
  • Automatic updates via npm update
Sources: README.md21-34 package.json2-3

Method 2: Per-Component Installation (buildy-ui CLI)

Use Case: Bundle optimization, progressive adoption, microservices
npx buildy-ui add button card text
Result: Copies component files to components/ui/ directory
components/
└── ui/
    ├── button.tsx
    ├── card.tsx
    └── text.tsx
Imports:
import { Button } from '@/components/ui/button';
import { Card } from '@/components/ui/card';
Advantages:
  • Minimal bundle size (only installed components)
  • No dependency on full library
  • Full source code control
Registry Metadata in src/registry.json1-244:
{
  "name": "button",
  "type": "registry:ui",
  "dependencies": ["class-variance-authority"],
  "files": [
    {
      "path": "components/ui/button.tsx",
      "type": "registry:ui"
    }
  ]
}
Sources: README.md252-276 src/registry.json1-244

Method 3: Git Submodule (Monorepo)

Use Case: Monorepo architectures, shared component libraries across projects
git submodule add https://github.com/ui8kit/core.git packages/@ui8kit/core
TypeScript Configuration:
{
  "compilerOptions": {
    "paths": {
      "@ui8kit/core": ["./packages/@ui8kit/core/src"]
    }
  }
}
Advantages:
  • Direct source access
  • Version pinning via git commits
  • Shared across monorepo packages
  • Local modifications possible
Sources: SUBMODULE_GUIDE.md1-300 (referenced in diagrams)

Method 4: Direct Source Integration

Use Case: Custom builds, heavily modified components, embedded systems Process:
  1. Copy src/ directory to project
  2. Adjust import paths
  3. Customize components as needed
  4. Build with project’s TypeScript compiler
Advantages:
  • Complete control over source code
  • No external dependencies
  • Custom compilation targets
  • Remove unused components

Method 5: Programmatic Registry Access

Use Case: Build tooling, component documentation generators, automated testing
import registry from '@ui8kit/core/registry.json';

// Iterate all components
registry.items.forEach(component => {
  console.log(`${component.name}: ${component.description}`);
  console.log(`Type: ${component.type}`);
  console.log(`Dependencies:`, component.dependencies);
});
Registry Structure:
{
  "name": "@ui8kit/core",
  "version": "1.0.0",
  "items": [
    {
      "name": "button",
      "type": "registry:ui",
      "description": "Action button component",
      "dependencies": ["class-variance-authority"],
      "files": [...]
    }
  ]
}
Advantages:
  • Automate component discovery
  • Generate documentation
  • Build custom CLI tools
  • Validate component metadata
Sources: README.md267-276 src/registry.json1-10

Component Inventory

Complete Component List

LayerComponent CountComponents
Layer 1: Core Primitives5Block, Box, Grid, Flex, Stack
Layer 2: UI Components15Button, Card, Text, Title, Container, Icon, Image, Badge, Group, Sheet, Accordion
Layer 3: Layouts3DashLayout, LayoutBlock, SplitBlock
Total23-

Component Distribution by Type

CategoryCountPurpose
Primitives5Foundation for all layouts and components
Content5Text, titles, images, icons, badges
Containers3Cards, groups, containers
Interactive2Buttons, sheets
Collapsible1Accordion
Layouts7Grid, Flex, Stack, DashLayout, LayoutBlock, SplitBlock, Container

Variant Coverage Statistics

Coverage AreaPercentageVariants Involved
Spacing30%16 props (p, m, px, py, etc.)
Colors20%3 props (bg, c, borderColor)
Layout20%5 props (w, h, minH, maxW, position)
Typography15%4 props (size, weight, align, leading)
Effects15%3 props (rounded, shadow, border)
Total Coverage~80%12 variant categories
Sources: README.md361-387 README.md388-403

Key Features Summary

Type Safety and Developer Experience

FeatureImplementationBenefit
Full TypeScript SupportAll components with precise prop interfacesPrevents runtime errors, IDE autocomplete
Prop ForwardingExtended components inherit base propsConsistent API, reduced learning curve
Semantic HTMLComponents render as section, article, nav, etc.Better accessibility (WCAG), improved SEO
Data AttributesAll components include data-class attributeConsistent DOM targeting for testing/styling
ForwardRef PatternAll components support ref forwardingDirect DOM access when needed

Performance and Bundle Size

OptimizationImplementationBenefit
Zero Runtime OverheadCVA generates static classes at build timeNo style calculation at runtime
Tree ShakingES2022 modules with sideEffects: falseUnused components removed by bundlers
Minimal DependenciesOnly 5 core dependenciesSmaller bundle size
Class Whitelist618 classes in core-classes.jsonTailwind purge safety
Per-Component InstallVia buildy-ui add commandInstall only what you need

Design Flexibility

CapabilityImplementationBenefit
Composable ArchitecturePrimitives combine into unlimited designsNo rigid design constraints
Variant System12 reusable categories~80% of styling without className
Compound ComponentsCard.Header, Card.Content, Card.FooterFlexible composition patterns
Dark ModeThemeProvider with persistenceBuilt-in theme support
Responsive DesignTailwind responsive prefixes work on all variantsMobile-first layouts
Sources: README.md9-19 package.json30 src/themes/providers/ThemeProvider.tsx1-109

Getting Started

To begin using @ui8kit/core, proceed to Getting Started for installation instructions and basic configuration examples. For detailed architectural documentation, see Architecture.
For component API reference, see API Reference.
For development patterns and best practices, see Development Guide.
Sources: .devin/wiki.json35-43 README.md21-60