### Initialize Alpine.js with Collapse Plugin Source: https://github.com/zhengyishen0/basis-ui/blob/main/registry/ui/README.md Shows the necessary setup for Alpine.js in an Astro layout file, including importing the library and the collapse plugin, then starting Alpine. This is crucial for the reactivity and features of the Pine UI components like the Accordion. ```astro --- // Layout.astro --- ``` -------------------------------- ### Alpine.js Store Integration Example (JavaScript) Source: https://github.com/zhengyishen0/basis-ui/blob/main/WARP.md This JavaScript snippet shows an example of an Alpine.js store integration. Component stores are copied with components and users can modify their behavior. This specific example defines a `tableStore` with state and methods relevant to data tables. ```javascript // Component stores are copied with components // Users can modify store behavior as needed export const tableStore = { // State and methods specific to data tables }; ``` -------------------------------- ### Basis UI CLI Init Command Logic (TypeScript) Source: https://github.com/zhengyishen0/basis-ui/blob/main/CLAUDE.md Outlines the steps performed by the 'init' command in the Basis UI CLI. This process includes project validation, installation of Alpine.js and plugins, Tailwind CSS setup, and configuration file creation for the component library. ```typescript // packages/cli/src/commands/init.ts // 1. Validates Astro project // 2. Installs Alpine.js + plugins // 3. Sets up Tailwind CSS with theme variables // 4. Creates components.json config // 5. Adds utility functions (cn, component variants) ``` -------------------------------- ### Install and Add Basis UI Components (Bash) Source: https://github.com/zhengyishen0/basis-ui/blob/main/README.md This snippet shows how to initialize a new Astro project with Basis UI and add specific components. It requires Node.js and npm/npx to be installed. ```bash # Initialize your Astro project npx @basisui/ui@latest init # Add components npx @basisui/ui add button card accordion ``` -------------------------------- ### Initialize Astro Project with Alpine.js CLI Source: https://context7.com/zhengyishen0/basis-ui/llms.txt Initializes a new Astro project with Alpine.js, Tailwind CSS, utility functions, and component configuration. It validates the Astro project, installs necessary Alpine.js and Astro integrations, sets up Tailwind CSS, configures tsconfig.json and tailwind.config.js, creates a global CSS file, and installs utility dependencies. This command also generates a components.json configuration file and a src/lib/utils.ts file with a cn() function. ```bash npx @basisui/ui init # Initialize with defaults (skip prompts) npx @basisui/ui init --yes # Initialize in specific directory npx @basisui/ui init --cwd /path/to/project ``` -------------------------------- ### Add Basis UI Component Library CLI Source: https://context7.com/zhengyishen0/basis-ui/llms.txt Downloads and installs the entire Basis UI component library (59 components) into your project. It checks for existing components.json, fetches the registry from GitHub, installs NPM dependencies, downloads library utilities, and extracts the UI component folder to the specified destination. This command allows for overwriting existing components and specifying custom paths or working directories. ```bash # Install complete library with prompts npx @basisui/ui add # Install with defaults (skip prompts) npx @basisui/ui add --yes # Overwrite existing components npx @basisui/ui add --overwrite # Custom component path npx @basisui/ui add --path ./src/components/custom-ui # Custom working directory npx @basisui/ui add --cwd /path/to/project ``` -------------------------------- ### Initialize Basis UI Project Source: https://github.com/zhengyishen0/basis-ui/blob/main/packages/cli/README.md Initializes your Astro project with Basis UI components. This command installs Alpine.js, sets up Tailwind CSS, creates a configuration file, and adds utility functions. ```bash npx @basisui/ui@latest init ``` -------------------------------- ### Basis UI CLI Installation Commands Source: https://github.com/zhengyishen0/basis-ui/blob/main/CLAUDE.md Demonstrates the core commands for interacting with the Basis UI CLI, including project initialization, component addition, and update checking. These commands facilitate the integration and management of UI components within an Astro project. ```bash npx @basisui/ui@latest init # Setup project npx @basisui/ui add button card # Add components npx @basisui/ui diff # Check updates ``` -------------------------------- ### Select Component Example in Astro Source: https://github.com/zhengyishen0/basis-ui/blob/main/registry/ui/README.md Demonstrates how to use the Select component for dropdown selection with search functionality. It takes an array of options and a placeholder string as input. ```astro