What is Kiwi.js?
Kiwi.js is a small, dependency-free JavaScript library focused on creating responsive UI primitives — tooltips, dropdowns, accessible modals, and tiny stateful behaviors — with an ergonomic API and predictable behavior. It aims to be tiny (under 4kb gzipped), framework-agnostic, and easy to reason about.
Tiny
Optimized for size and performance; no dependencies.
Accessible
ARIA-friendly defaults and keyboard interactions built-in.
Framework-agnostic
Works with plain JS, React, Vue, Svelte, or server-side rendered pages.
Install
Pick one of the options below:
NPM
npm install kiwi-js
CDN
<script src="https://cdn.example.com/kiwi.min.js"></script>
Quickstart
Example: Initialize a tooltip and a dropdown with minimal code.
HTML
{` Tooltip content`}
JavaScript
{`import { Tooltip, Dropdown } from 'kiwi-js' Tooltip.attach('#tip-btn', '#tip') Dropdown.attach('#menu-btn', '#menu')`}
Kiwi exposes simple helpers like attach()
that take a
toggler and a target element and handle ARIA attributes, keyboard
navigation, and focus management for you.
API
Tooltip
-
Tooltip.attach(togglerSelector, targetSelector, options)
- Options:
{"{placement:'top',delay:100}