Astro
Install and configure Glass UI in an Astro project.
Installation
Create a new project
Start by creating a fresh Astro project. If you already have a project, you can skip this step.
npm create astro@latestAdd React
Add the official React integration to your Astro project:
npx astro add reactInstall Tailwind CSS
Install Tailwind CSS and its Vite plugin. If your project already has it configured, you can skip this step.
npm install tailwindcss @tailwindcss/viteConfigure Astro
Add the Tailwind CSS plugin to your astro.config.mjs file via the Vite configuration:
Import Tailwind CSS
Create a src/styles/global.css file and add the Tailwind import directive:
Add Styles to Layout
Import the global.css file into your main layout so the styles are applied globally across your application:
Configure Path Aliases
Verify that your tsconfig.json includes the paths configuration:
Run the CLI
Run the init command to set up your configuration, base utilities, and global styles.
npx @glass-ui-kit/cli@latest initAdd your first component
You can now start adding glassmorphism components to your project. Let’s add the Card component:
npx @glass-ui-kit/cli@latest add cardUse the component
Replace the contents of your src/pages/index.astro with the following code: