8

JavaScript

How to use AxionJS with JavaScript

Overview

AxionJS components are primarily written in TypeScript. However, you can also opt to use them in JavaScript projects.

We recommend using TypeScript for better type safety. If you still prefer JavaScript, follow these steps.

Configure components.json

Set the tsx flag to false to generate JavaScript components:

components.json
{
  "style": "default",
  "tailwind": {
    "config": "tailwind.config.js",
    "css": "app/globals.css",
    "baseColor": "default",
    "cssVariables": true
  },
  "rsc": false,
  "tsx": false,
  "aliases": {
    "components": "@/components"
  }
}

Configure jsconfig.json

Set up path aliases for a JavaScript project:

jsconfig.json
{
  "compilerOptions": {
    "paths": {
      "@/*": ["./*"]
    }
  }
}

On this page