V1.0

Remix

Step-by-Step configuration for Remix

Kickstart with our Remix Starter πŸš€
Everything is set up to use AlignUI!

Initialize a Remix Project

If you don’t already have a Remix project set up, you can follow the official Remix setup guide to create a new project quickly.

Make sure you have Tailwind installed

Follow these instructions if you don't have Tailwind installed in your project. You just need to have a tailwind.css and tailwind.config.{js,ts}. They will be overwritten by our CLI.

Add AlignUI Styles

Run the following command in the root directory of your project.

terminal
npx @alignui/cli tailwind
Warning

This will overwrite your Tailwind Config and CSS file.

This command will prompt you to choose following options.

β”Œ  AlignUI Tailwind Setup
β”‚
β—‡ Which color would you like to use as primary color?
β”‚  ● Blue 
β”‚  β—‹ Purple
β”‚  β—‹ Orange
β”‚  β—‹ Sky
β”‚
β—‡ Which color would you like to use as neutral color?
β”‚  ● Gray 
β”‚  β—‹ Slate
β”‚
β—‡ Which color format would you like to use?
β”‚  ● hex 
β”‚  β—‹ rgb
β”‚  β—‹ hsl
β”‚
β—‡ Use a custom prefix for AlignUI classes? (Leave blank for none)
β”‚  undefined
β”‚
β—‡ Where is your tailwind config file?
β”‚  tailwind.config.ts
β”‚
β—‡ Where is your global CSS file?
β”‚  app/globals.css
β””

That's all! Now you have all AlignUI tokens.

Add the required utils

  1. Go to cn page and setup the utility in your project.
  2. Go to tv page and setup the utility in your project.
  3. Go to recursiveCloneChildren page and setup the utility in your project.
  4. Go to Polymorphic page and setup the utility in your project.

Add the icon library

AlignUI uses Remix Icon.

terminal
npm install @remixicon/react

Setup Inter font

Include Inter font from Google Fonts:

/app/root.tsx
import type { LinksFunction } from '@remix-run/node';
 
export const links: LinksFunction = () => [
  { rel: 'preconnect', href: 'https://fonts.googleapis.com' },
  {
    rel: 'preconnect',
    href: 'https://fonts.gstatic.com',
    crossOrigin: 'anonymous',
  },
  {
    rel: 'stylesheet',
    href: 'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap',
  },
];

Then apply Inter as the default tailwind font.

tailwind.config.ts
import type { Config } from 'tailwindcss';
import defaultTheme from 'tailwindcss/defaultTheme';
 
export default {
  content: ['./app/**/*.{js,jsx,ts,tsx}'],
  theme: {
    extend: {
      fontFamily: {
        sans: ['Inter', ...defaultTheme.fontFamily.sans],
      },
    },
  },
  plugins: [],
} satisfies Config;

Add Dark Mode (Optional)

All you need to do to enable dark mode in your app is add the dark class to your root element.

/app/root.tsx
export default function Layout({ children }) {
  return (
    <html lang='en' className='dark'>
      <body>{/* ... */}</body>
    </html>
  );
}

We need to include the 'dark' class in the safelist in Tailwind Config. Otherwise, dark colors will not be included if the 'dark' class is absent in your JSX at build-time.

tailwind.config.ts
export default {
  content: [
    /* ... */
  ],
  safelist: ['.dark'],
  plugins: [],
} satisfies Config;

I recommend next-themes package for an easy dark mode toggle in your app. Simply follow the instructions on the page.

That's all!

Now you can start adding components to your app. You can begin by adding a button first.

Β© 2024 AlignUI Design System. All rights reserved.