Integrate ZikoJS components into Astro applications.
Install the integration with Astro's CLI:
npx astro add @zikojs/astroOr install it manually:
npm install @zikojs/astroThen add the integration to your astro.config.mjs:
import { defineConfig } from "astro/config";
import ziko from "@zikojs/astro";
export default defineConfig({
integrations: [ziko()],
});Create a ZikoJS component:
// HelloFromZikoJs.js
import { p } from "ziko/dom";
export default function HelloFromZikoJs({ color }) {
return p("Hello From ZikoJS").style({ color });
}Import the component into an .astro file:
---
import HelloFromZikoJs from "./HelloFromZikoJs.js";
---
<HelloFromZikoJs
color="orange"
client:only="javascript"
/>The client:only="javascript" directive tells Astro to render the ZikoJS component exclusively on the client.
MIT