1.5.34 • Published 9 months ago

@silvergravel/cosmoslib v1.5.34

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

Installation and Setup Guide for cosmoslib

This guide will walk you through setting up a new project with Vite, Tailwind CSS, and cosmoslib.

1. Create a new Vite project

First, create a new Vite project with React and TypeScript:

npm create vite@latest my-project -- --template react-ts
cd my-project
npm install

2. Install and configure Tailwind CSS

Install Tailwind CSS and its peer dependencies:

npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

3. Install cosmoslib

Install cosmoslib:

npm install @silvergravel/cosmoslib

4. Configure Tailwind CSS

Update your tailwind.config.js:

import { tailwindConfig } from '@silvergravel/cosmoslib';

export default {
  ...tailwindConfig,
  content: [
    ...tailwindConfig.content,
    "./node_modules/@silvergravel/cosmoslib/dist/**/*.{js,jsx,ts,tsx}",
    "./src/**/*.{js,ts,jsx,tsx}",
  ],
}

5. Update CSS file

In your main CSS file (e.g., src/index.css), add the following:

@import '@silvergravel/cosmoslib/style.css';

@tailwind base;
@tailwind components;
@tailwind utilities;

6. Wrap your app with RadixThemeProvider

In your main App component (e.g., src/App.tsx):

import { RadixThemeProvider } from '@silvergravel/cosmoslib';

function App() {
  return (
    <RadixThemeProvider>
      {/* Your app content */}
    </RadixThemeProvider>
  );
}

export default App;

7. (Optional) Custom Theme Configuration

You can customize the font and color configuration by creating a THEME_CONFIG.ts file:

export const fontConfig = {
  defaultFont: {
    name: "Hind",
    url: "https://fonts.googleapis.com/css2?family=Hind:wght@300;400;500;600;700&display=swap",
  },
  headingFont: {
    name: "Jost",
    url: "https://fonts.googleapis.com/css2?family=Jost:ital,wght@0,100..900;1,100..900&display=swap",
  },
  baseTypeSetting: {
    // ... (your custom type settings)
  }
};

export const colorConfig = {
  secondaryColor: 'purple',
  accentColor: 'tomato',
  grayColor: 'slate'
};

Then, pass these configurations to the RadixThemeProvider:

import { RadixThemeProvider } from '@silvergravel/cosmoslib';
import { fontConfig, colorConfig } from './THEME_CONFIG';

function App() {
  return (
    <RadixThemeProvider colorConfig={colorConfig} fontConfig={fontConfig}>
      {/* Your app content */}
    </RadixThemeProvider>
  );
}

Note: If you don't provide fontConfig or colorConfig, cosmoslib will use its default configurations.

8. Start your development server

Run your Vite development server:

npm run dev

Your project is now set up with Vite, Tailwind CSS, and cosmoslib. You can start using cosmoslib components and utilities in your React components.

1.1.0

9 months ago

1.0.0

9 months ago

1.5.4

9 months ago

1.5.2

9 months ago

1.5.1

9 months ago

1.5.0

9 months ago

1.5.30

9 months ago

1.5.32

9 months ago

1.5.10

9 months ago

1.5.31

9 months ago

1.5.34

9 months ago

1.5.12

9 months ago

1.5.33

9 months ago

1.5.11

9 months ago

1.5.14

9 months ago

1.5.13

9 months ago

1.5.16

9 months ago

1.5.15

9 months ago

1.5.18

9 months ago

1.5.17

9 months ago

1.5.19

9 months ago

1.5.21

9 months ago

1.5.9

9 months ago

1.5.20

9 months ago

1.5.8

9 months ago

1.5.23

9 months ago

1.5.7

9 months ago

1.5.22

9 months ago

1.5.6

9 months ago

1.5.25

9 months ago

1.5.24

9 months ago

1.5.27

9 months ago

1.5.26

9 months ago

1.5.29

9 months ago

1.5.28

9 months ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago