Skip to content

Installation

Installing components

Choose your preferred package manager to install the components. The package includes TypeScript definitions out of the box and requires no additional configuration.

Terminal window
npm install accessible-astro-components

Installing themes

Our themes come with all the components pre-installed and configured. You can choose between using git clone or degit for installation.

Starter theme

Terminal window
git clone https://github.com/markteekman/accessible-astro-starter.git my-project

Dashboard theme

Terminal window
git clone https://github.com/markteekman/accessible-astro-dashboard.git my-dashboard

Post installation

After installing, you’ll need to set up your project. The steps differ slightly depending on whether you’re using the components package or a theme.

Components setup

  1. Import the components you need:
---
import { Modal, Notification } from 'accessible-astro-components'
---
  1. Add the component to your template:
<Modal triggerId="modal" title="Welcome">
<p>Content goes here</p>
</Modal>

Theme setup

  1. Install dependencies:
Terminal window
cd my-project
npm install
  1. Start development server:
Terminal window
npm run dev

Optional dependencies

Some components require additional packages to unlock their full potential. Here’s what you might need:

Icon support

To use icons in components like Notifications:

Terminal window
npm install astro-icon

ESLint for accessibility

We recommend using ESLint with accessibility rules to catch common issues during development:

Terminal window
npm install -D eslint-plugin-jsx-a11y

Troubleshooting

Here are some common issues you might encounter and how to resolve them:

Common issues

  1. Port conflicts: If port 4321 is in use, Astro will automatically try the next available port.

  2. Node.js version: Ensure you’re using Node.js 18.14.1 or higher:

Terminal window
node --version
  1. Dependency conflicts: Clear your dependencies and reinstall if needed:
Terminal window
rm -rf node_modules package-lock.json
npm install