Installation
Installing components
Section titled “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.
npm install accessible-astro-components
pnpm add accessible-astro-components
yarn add accessible-astro-components
Installing themes
Section titled “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
Section titled “Starter theme”git clone https://github.com/incluud/accessible-astro-starter.git my-project
npx degit incluud/accessible-astro-starter my-project
Dashboard theme
Section titled “Dashboard theme”git clone https://github.com/incluud/accessible-astro-dashboard.git my-dashboard
npx degit incluud/accessible-astro-dashboard my-dashboard
Post installation
Section titled “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
Section titled “Components setup”-
Import the components you need:
---import { Modal, Notification } from 'accessible-astro-components'--- -
Add the component to your template:
<Modal triggerId="modal" title="Welcome"><p>Content goes here</p></Modal>
Theme setup
Section titled “Theme setup”-
Install dependencies:
Terminal window cd my-projectnpm install -
Start development server:
Terminal window npm run dev
Optional dependencies
Section titled “Optional dependencies”Some components can be enhanced with additional packages to unlock their full potential. Here’s what we recommend:
Icon support
Section titled “Icon support”To use icons in components like Notifications:
npm install astro-icon
import icon from 'astro-icon'
export default defineConfig({ integrations: [icon()]})
ESLint for accessibility
Section titled “ESLint for accessibility”We recommend using ESLint with accessibility rules to catch common issues during development:
npm install -D eslint-plugin-jsx-a11y
Troubleshooting
Section titled “Troubleshooting”Here are some common issues you might encounter and how to resolve them:
Common issues
Section titled “Common issues”-
Port conflicts: If port 4321 is in use, Astro will automatically try the next available port.
-
Node.js version: Ensure you’re using Node.js 18.14.1 or higher:
node --version
- Dependency conflicts: Clear your dependencies and reinstall if needed:
rm -rf node_modules package-lock.jsonnpm install