Installation

CDN

Quickly add our components using our CDN:

<link href="https://cdn.ocg.com/css/components.min.css" rel="stylesheet">
<script src="https://cdn.ocg.com/js/components.min.js"></script>

npm

For more control, install via npm:

npm install @ocg/components

Usage

After installing, import the components you need:

import { Button, Card, Modal } from '@ocg/components';

// Initialize all components
Button.init();
Card.init();
Modal.init();

Or initialize all components at once:

import OCG from '@ocg/components';
OCG.initAll();

Components

Button

<button class="ocg-btn">Default</button>
<button class="ocg-btn hover:ocg-btn-hover">Hover</button>
<button class="ocg-btn ocg-btn-outline">Outline</button>

Card

Card Title

This is a basic card component with hover effects.

<div class="ocg-card">
  <h4>Card Title</h4>
  <p>Card content...</p>
  <button class="ocg-btn">Action</button>
</div>

Modal

// HTML
<button id="trigger-modal" class="ocg-btn">Show Modal</button>

// JavaScript
import { Modal } from '@ocg/components';
Modal.init({
  trigger: '#trigger-modal',
  content: '<h3>Modal Title</h3><p>Modal content...</p>'
});

Customization

You can customize the theme by overriding CSS variables:

:root {
  --ocg-primary: 249, 115, 22;
  --ocg-secondary: 59, 130, 246;
  --ocg-text: 249, 250, 251;
  --ocg-bg: 17, 24, 39;
}

Or via JavaScript configuration:

OCG.config({
  theme: {
    primary: '#f97316',
    secondary: '#3b82f6',
    text: '#f9fafb',
    bg: '#111827'
  }
});

Troubleshooting

Common Issues

Components not initializing

Make sure you've included the required dependencies (Tailwind CSS, Feather Icons) and called the initialization methods.

Styles not applying

Ensure the CSS file is loaded before your custom styles and that there are no conflicting selectors.

JavaScript errors

Check the console for error messages and verify you're using the correct version of the library.