A collection of checkbox implementations using different frameworks and approaches.
pnpm install
pnpm dev
touch .env # Create an empty .env file
# Get your GEMINI_API_KEY from https://makersuite.google.com/app/apikey
# Add it to .env: GEMINI_API_KEY=your_key_here
# The API key is used for generating complexity scores
# Run these commands in sequence:
pnpm build # Build the project
pnpm preview # Start the preview server (in a separate terminal)
pnpm generate-stats # Generate performance metrics (in a new terminal)
Create Framework Files
src/components
with your framework namesrc/your-framework/your-framework<.tsx/jsx/etc>
- The checkbox implementationsrc/your-framework/your-framework-container.astro
- The display wrapperUpdate Framework Configuration
src/config/frameworks.ts
:export const FRAMEWORKS = {
yourFramework: {
displayName: "Your Framework", // Name shown in the UI
},
// ... existing frameworks
};
Add Framework Integration
pnpm add @astrojs/your-framework your-framework
astro.config.mjs
to add the framework integration:import yourFramework from '@astrojs/your-framework';
export default defineConfig({
integrations: [
// ... existing integrations
yourFramework(),
],
});
Update Test Page
src/pages/test/[framework].astro
to include your framework:---
import YourFramework from "../../components/your-framework/your-framework";
// ... existing imports
---
<div class="framework-container">
{/* Add your framework */}
{frameworkId === "yourFramework" && <YourFramework client:only="your-framework" />}
{/* ... existing frameworks */}
</div>
Add Framework Stats
src/config/stats.ts
if your framework needs special handling:SUPPORTED_EXTENSIONS: [
".tsx",
".jsx",
".astro",
".vue",
".svelte",
".your-extension" // Add if needed
],
pnpm generate-stats
At this point, you could open a PR. For full framework integration, see the Astro Framework Integration Guide. This usually involves modifying the astro.config.mjs
file to add the framework and its configuration.
If you want to generate performance metrics for your new implementation, see the Generate performance metrics section.
generate-stats
fails, ensure:pnpm build
before running pnpm preview
generate-stats
SUPPORTED_EXTENSIONS
within src/config/stats.ts
src/
├── components/
│ ├── react/
│ │ ├── ReactNestedCheckboxes.tsx
│ │ └── ReactContainer.astro
│ ├── alpine/
│ │ ├── alpine.astro
│ │ └── AlpineContainer.astro
│ ├── [other-frameworks]/ # Similar structure for other frameworks
│ │ └── ...
│ └── CodeBlock.astro # Shared code display component
├── layouts/
│ └── Layout.astro # Base layout
└── pages/
└── index.astro # Main page
Each framework implementation is evaluated on two key metrics:
type: "Script"
)Both metrics are normalized using z-scores to provide relative performance indicators, displayed as colored badges:
Check out the live demo at checkboxes.xyz
This project is licensed under the MIT License - see the LICENSE file for details.