1.5.34 • Published 10 months ago

@silvergravel/cosmoslib v1.5.34

Weekly downloads
-
License
ISC
Repository
-
Last release
10 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

10 months ago

1.0.0

10 months ago

1.5.4

10 months ago

1.5.2

10 months ago

1.5.1

10 months ago

1.5.0

10 months ago

1.5.30

10 months ago

1.5.32

10 months ago

1.5.10

10 months ago

1.5.31

10 months ago

1.5.34

10 months ago

1.5.12

10 months ago

1.5.33

10 months ago

1.5.11

10 months ago

1.5.14

10 months ago

1.5.13

10 months ago

1.5.16

10 months ago

1.5.15

10 months ago

1.5.18

10 months ago

1.5.17

10 months ago

1.5.19

10 months ago

1.5.21

10 months ago

1.5.9

10 months ago

1.5.20

10 months ago

1.5.8

10 months ago

1.5.23

10 months ago

1.5.7

10 months ago

1.5.22

10 months ago

1.5.6

10 months ago

1.5.25

10 months ago

1.5.24

10 months ago

1.5.27

10 months ago

1.5.26

10 months ago

1.5.29

10 months ago

1.5.28

10 months ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago