Skip to content
Quick Start

Quick Start

Quick Start

Get up and running with PrimitiveKit in 5 minutes.

1. Install

Choose your framework and install the package:

npm install @primitivekit/react

2. Import Design Tokens

Import the design tokens CSS file in your application’s entry point:

// src/main.tsx or src/App.tsx
import '@primitivekit/react/tokens/tokens.css';

3. Use Components

Import and use components in your application:

import { Card, Button, Badge } from '@primitivekit/react';

function App() {
  return (
    <div className="app">
      <Card variant="elevated" hoverable>
        <Badge variant="solid" color="primary">New</Badge>
        <h2>Welcome to PrimitiveKit</h2>
        <p>Build beautiful UIs with zero hardcoded values.</p>
        <Button onClick={() => alert('Hello!')}>
          Get Started
        </Button>
      </Card>
    </div>
  );
}

export default App;

4. Customize (Optional)

Override CSS variables to customize the look and feel:

/* styles.css */
:root {
  /* Colors */
  --color-primary: #0ea5e9;
  --color-secondary: #8b5cf6;
  
  /* Spacing */
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  
  /* Typography */
  --font-family-base: 'Inter', sans-serif;
  --font-size-base: 1rem;
  
  /* Border Radius */
  --border-radius-sm: 0.25rem;
  --border-radius-md: 0.5rem;
  --border-radius-lg: 0.75rem;
}

Complete Example

Here’s a complete example with multiple components:

import { 
  Card, 
  Button, 
  Badge, 
  Input, 
  Stack,
  Divider 
} from '@primitivekit/react';
import '@primitivekit/react/tokens/tokens.css';
import { useState } from 'react';

function App() {
  const [name, setName] = useState('');

  return (
    <div style={{ padding: '2rem', maxWidth: '600px', margin: '0 auto' }}>
      <Card variant="elevated">
        <Stack direction="vertical" spacing="lg">
          <div>
            <Badge variant="solid" color="primary">New Feature</Badge>
            <h1>Welcome to PrimitiveKit</h1>
            <p>Build beautiful UIs with zero hardcoded values.</p>
          </div>
          
          <Divider />
          
          <div>
            <label htmlFor="name">Your Name</label>
            <Input
              id="name"
              placeholder="Enter your name"
              value={name}
              onChange={(e) => setName(e.target.value)}
            />
          </div>
          
          <Button 
            variant="primary" 
            onClick={() => alert(`Hello, ${name || 'World'}!`)}
          >
            Say Hello
          </Button>
        </Stack>
      </Card>
    </div>
  );
}

export default App;

Next Steps

Need Help?