Using the Styled Kit
CLI
Simply run the following command:
(or "npx qwik-ui init" if you prefer npm)
This will help you install tailwind, create a qwik-ui.config.json
file and modify your root/global css and tailwind config files with the necessary Qwik UI design system variables and values (see below)
Generating components using the CLI
When you want to add a component you can run:
Or if you know a specific component you want to add, let's say "input
", you can run:
Manual installation
Step 1: Install the Headless Kit and qwikest icons
Step 2: copy/paste your theme config
Click on "make it yours" -> choose your favorite color theme and style -> copy/paste the css-variables config to your global css file.
For example, we use the following config by default on the Qwik UI docs:
Step 3: Modify your tailwind.config.js file
Finally, you need to modify your tailwind.config.js
file:
This might seem like a lot of configuration, but we believe it to be worth it because it allows changing your entire application's theme at the click of a button.
Step 4: Find the components you need in the docs and copy/paste them into your project
You will find the components code in their corresponding link in the docs.
Bonus step: add a barrel file to ~/components/ui
This way you can now import { Accordion, Alert, ... } from '~/components/ui';
👯♀️
(small tip: you can comment out the components you don't use!)
Tailwind CSS IntelliSense VSCode extension
If you don't already have it, go ahead and install the Tailwind CSS IntelliSense extension for vscode.
Then, edit your settings.json with the following:
This will enable the extension to recognize the Qwik UI utility functions and give you the same autocompletion you get with the default Tailwind classes.
You can thank us later... 😉