Skip to main content

Vite

To use GamiUI in your Vite project, you need to follow the steps below, depending on your project structure.

gamiBrain
  • 1. Add dependencies:

    In your Vite project, run one of the following commands to install GamiUI:


      npm i @gamiui/standard
  • 2. Provider Setup:

    Go to the src directory and inside main.jsx or main.tsx, wrap ThemeGamification around App:


      // main.tsx or main.jsx
    import React from 'react'
    import ReactDOM from 'react-dom/client'
    import { ThemeGamification } from "@gamiui/standard";
    import App from './App'
    import './index.css'

    ReactDOM.createRoot(document.getElementById('root')).render(
    <React.StrictMode>
    <ThemeGamification>
    <App />
    </ThemeGamification>
    </React.StrictMode>,
    )
  • 3. Use GamiUI Components:

    Now you can import any GamiUI component directly:


      import {Button} from '@gamiui/standard'; 

    export default function MyComponent() {
    return (
    <div>
    <Button>Click me</Button>
    </div>
    )
    }