vechai / vechaiui

A set of high-quality accessible React UI components with the built-in dark mode using Tailwind CSS. Pre-designed headless ui and radix-ui.

Home Page:https://www.vechaiui.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Components doesn't work

Mnigos opened this issue · comments

Hi I used the Button component and It didn't apply style on it.

_app.tsx

import React from 'react'
import type { AppProps } from 'next/app'
import { VechaiProvider, Button } from '@vechaiui/react'

export default function App({ Component, pageProps }: AppProps) {
  return (
    <VechaiProvider>
      <Button>e</Button>
      <Component {...pageProps} />
    </VechaiProvider>
  )
}

tailwind.config.ts

export default {
  mode: 'jit',
  purge: [
    './pages/**/*.{js,ts,jsx,tsx}',
    './components/**/*.{js,ts,jsx,tsx}',
    './node_modules/@vechaiui/**/*.{js,ts,jsx,tsx}',
  ],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [require('@tailwindcss/forms'), require('@vechaiui/core')],
}

image

You must import tailwind styles in _app.tsx

import '../styles/globals.css';

globals.css

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

You can check basic setup here: https://stackblitz.com/edit/nextjs-pvx8qa?file=pages%2Findex.js

Yes I fixed that, and for now I see that tailwindcss styles applies, but venchaui doesn't

You can download the demo or playground with stackblitz link ... I don't have enough context to find this bug

I see that config i recreated it, and it still doesn't work.

Ok, so to fix that error I was forced to create a new project.

i meet the same problem, did you solve it ?

Ok, so to fix that error I was forced to create a new project.

i forget add VechaiProvider, after adding it, some styles apply, but still any styles didn't work,like color. But i really need a ui library, so i copy all styles from the website vechaiui.com 😂

This is what you need to have in your tailwind.config.js:

module.exports = {
  mode: 'jit',
  purge: [
    './pages/**/*.{js,ts,jsx,tsx}',
    './components/**/*.{js,ts,jsx,tsx}',
    './node_modules/@vechaiui/**/*.{js,ts,jsx,tsx}', // path to vechaiui
  ],
  plugins: [require('@tailwindcss/forms'), require('@vechaiui/core')],
  darkMode: 'class', // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
}

This is what you need to have in your tailwind.config.js:

module.exports = {
  mode: 'jit',
  purge: [
    './pages/**/*.{js,ts,jsx,tsx}',
    './components/**/*.{js,ts,jsx,tsx}',
    './node_modules/@vechaiui/**/*.{js,ts,jsx,tsx}', // path to vechaiui
  ],
  plugins: [require('@tailwindcss/forms'), require('@vechaiui/core')],
  darkMode: 'class', // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
}

Yes, the tailwind.config.js always has the config like this,but some styles don't work
image
the icon is plain