Installation Guide

Installation

To install KnoxUI React, run one of the following commands in your project directory:

npm install knoxui-react

or if you're using Yarn:

yarn add knoxui-react

Setup

After installation, wrap your application with the ThemeProvider component:


import { ThemeProvider } from 'knoxui-react'

export default function App({ children }) {
  return (
    <ThemeProvider attribute="class" defaultTheme="light">
      {children}
    </ThemeProvider>
  )
}
        

Usage

Here's a simple example of how to use KnoxUI React components:


import React from 'react';
import { Button, Input, useTheme } from 'knoxui-react';

const MyComponent = () => {
  const { theme, setTheme } = useTheme();

  return (
    <div>
      <Button onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}>
        Toggle Theme
      </Button>
      <Input placeholder="Enter your name" />
    </div>
  );
};
        

Live Example

Here's a live example of KnoxUI React components in action:

Additional Resources