--- layout: layouts/page.njk title: Installation description: How to install and use Basecoat in your app. toc: - label: Installing the CSS id: install-css children: - label: Add Tailwind CSS id: install-css - label: Add Basecoat id: install-css-basecoat - label: Import basecoat in your CSS id: install-css-import - label: That's it id: install-css-done - label: Components with Javascript id: install-js - label: Use the CLI id: install-cli - label: Use Nunjucks or Jinja macros id: install-macros - label: Theming id: install-theming --- {% from "macros/code_block.njk" import code_block %}
Basecoat uses Tailwind CSS. You need to install it in your project.
Follow the Tailwind CSS installation instructions to get started.
Add Basecoat to your Tailwind CSS file.
Alternatively, you can directly copy the basecoat.css file into your project.
You can now use any of the Basecoat classes in your project (e.g. btn, card, input, etc). Read the documentation about each component to get started (e.g. button, card, input, etc).
Some components (e.g. Select) require Javascript code to work.
Some components require Javascript code to work.
The documentation provides Alpine.js code snippets to cover that. Make sure to install Alpine.js if you decide to use them.
For simple components like Accordion or Slider, you will notice some inline Alpine.js code that you can just copy along with the rest of the HTML.
For more complex components (Dialog, Dropdown Menu, Popover, Select, Tabs and Toast), you have one of 2 options:
Download the script as a separate file and include it in your project (or let the CLI do it for you). If you use this approach, make sure to load the file before the Alpine.js core JS file and register the component on the alpine:init event. For example:
You are also welcome to write your own Javascript.
All of the components try and implement WAI-ARIA standards to make them accessible.
If you're using Nunjucks or Jinja, you can use the CLI to install the CSS and macros for any of the complex components(e.g. Dialog). It will copy the JS and `.html.jinja or .njk macros into your code.
For example, to add the Dialog component, run:
{% set code %}npx basecoatui add dialog{% endset %} {{ code_block(code, "bash") }}You will be asked to confirm the template engine and destination directory for the Javascript and macros.
For more complex components, you can use Nunjucks or Jinja macros to help you generate the HTML and Javascript code.
To install them, either copy them directly from the GitHub repository or use the CLI to do the work for you.
For example, here's how you could use the select() macro to generate the HTML and Javascript code for a Select component:
Make sure to include the Javascript code before Alpine.js core JS file:
{% set code %} {% endset %} {{ code_block(code, "jinja") }}You can import any shadcn/ui compatible theme (e.g. tweakcn). For example:
theme.css).