How to get started with Chord.
There are 2 base requirements that are needed in your project to make Chord work.
Chord is built on top of Tailwind CSS, so you need to have it installed in your project. You can install it by running the following command. You can find the installation guide
Chord is built on top of Base UI primitives, so you need to have it installed in your project. You can install it by running the following command. You can find the installation guide
Chord requires the following packages to be installed in your project. These are required to power the component primitivaes and the animations etc. You can run the following command to install all of them.
npm install @radix-ui/colors @phosphor-icons/react motion tailwind-merge clsxAdd the following CSS files to your project.
Add the following helper file to your project. This utility merges Tailwind classes safely and is used across all Chord components.
helpers/classname-helper.ts
import { type ClassValue, clsx } from "clsx";import { twMerge } from "tailwind-merge";export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs));}Chord uses two color axes that you can customise to match your brand: a grayscale for backgrounds, borders, and text, and an accent for interactive elements and highlights.
In theme.css, the default :root block maps --color-grayscale-* to gray. Change it to any of the available grayscale palettes:
Similarly, the --color-accent-* variables default to blue. Swap it to any of the accent palettes:
To apply your choice, set the data-grayscale and data-accent attributes on your root element (e.g. <html data-grayscale="slate" data-accent="violet">), or change the default values directly in the :root block of theme.css.
When choosing a grayscale to pair with your accent, you have two approaches.
If you want a neutral vibe, or you want to keep things simple, gray will work well with any hue or palette.
Alternatively, choose the grayscale which is saturated with the hue closest to your accent. The difference is subtle, but this creates a more colorful and harmonious vibe.
Works with all accent colors
Each Radix color palette has 12 steps, and each step is designed for a specific use case. Read more on the Radix Colors documentation.