Restructure the repo into npm workspaces so the component kit publishes as its own package, like MUI and shadcn/ui: - packages/ui: @openkhalix/tansy-ui (published), with components, stories, tests, tokens and the library build - packages/brand: private logo and catalogue data shared by both apps - apps/site: the landing page - apps/docs: Storybook The package: - MIT licence (copyright OpenKhalix) - per-component ES modules and type declarations - "use client" on component modules so they import into Next.js Server Components; helpers stay server-safe - tokens.css for Tailwind v4 apps, and a prebuilt styles.css for apps without Tailwind - lucide-react 1.x, whose types compile against current React 19 types The apps resolve the package through a "source" export condition, so they hot-reload component edits, while outside users get dist/. scripts/test-package.mjs packs the package and installs the tarball into Vite + Tailwind (strict types), plain React and Next.js apps; each must build and render correctly. Gitea workflows run CI on push and publish to npm when a vX.Y.Z tag matching the package version is pushed.
Tansy UI
A themeable, accessible React component kit by OpenKhalix, built on Base UI and Tailwind CSS v4.
- 38 components: forms with floating labels, selects and comboboxes, dialogs, drawers, menus, tabs, toasts, tables and more.
- Accessible: keyboard support and screen-reader wiring from Base UI, visible focus rings, and every story checked with axe in light and dark mode.
- Themeable: seven palettes switchable at runtime, class-based dark mode, and one semantic token set.
- One API:
color,variantandsizeon everything;label,descriptionanderroron every field; controlled or uncontrolled values.
Docs and live examples: https://ui.openkhalix.com/docs/
Install
npm install @openkhalix/tansy-ui
Needs React 19. @base-ui/react, lucide-react, clsx and tailwind-merge install with it.
Add the styles
Pick one of the two setups.
With Tailwind CSS v4 (recommended)
Import the tokens after Tailwind, and let Tailwind scan the package for the classes it uses:
/* app.css */
@import "tailwindcss";
@import "@openkhalix/tansy-ui/tokens.css";
@source "../node_modules/@openkhalix/tansy-ui/dist";
Your own Tailwind utilities can then use the same tokens (bg-surface, text-fg, bg-primary-500).
Without Tailwind
Import the prebuilt stylesheet once, for example in your entry file:
import '@openkhalix/tansy-ui/styles.css'
It contains the tokens, only the utilities the components use, and a modern CSS reset (Tailwind's
preflight), which the components rely on, much as MUI relies on CssBaseline. The reset normalises
margins, borders and form controls across your app. If you already use Tailwind, use the setup above
instead.
Use
import { Mail } from 'lucide-react'
import { Button, FeaturedInput, Select, Switch } from '@openkhalix/tansy-ui'
export function InviteForm() {
return (
<form className="grid max-w-sm gap-5">
<FeaturedInput label="Work email" type="email" startIcon={<Mail />} required />
<Select
label="Team"
options={[
{ value: 'design', label: 'Design' },
{ value: 'engineering', label: 'Engineering' },
]}
/>
<Switch label="Send a welcome email" defaultChecked />
<Button type="submit">Send invite</Button>
</form>
)
}
Next.js
Components are marked "use client", so you can import them straight into Server Components. Helpers such
as cn and applyPalette stay server-safe.
Dark mode and palettes
import { applyPalette } from '@openkhalix/tansy-ui'
document.documentElement.classList.toggle('dark', true) // dark mode
applyPalette(document.documentElement, 'emerald') // classicBlue, emerald, violet, amber, crimson, slate, teal
Apply a palette to <html> so popups, which render in a portal, pick it up too.
Components
| Group | Components |
|---|---|
| Actions | Button, IconButton, LinkButton, ToggleGroup, Toggle |
| Forms | Field, Input, FeaturedInput, TextArea, FeaturedTextArea, NumberInput, Select, FeaturedSelect, Combobox, NativeSelect, Checkbox, CheckboxGroup, Radio, Switch, Slider |
| Overlays | Dialog (Modal), AlertDialog, Drawer (Sheet), Popover, Tooltip, InfoTip, DropdownMenu |
| Navigation | Tabs, Accordion, Breadcrumb, Pagination |
| Feedback | Alert, Toast (Toaster, useToast), Spinner, Progress, Meter, Skeleton |
| Display | Badge, CountBadge, Avatar, AvatarGroup, Kbd, Table |
| Layout | Card, Separator |
Every component has a Storybook page with its props, controls and a story for each state: https://ui.openkhalix.com/docs/
Licence and credit
MIT © OpenKhalix. Use it, fork it, and ship it in commercial products, free. The licence's only condition is that you keep the copyright notice in copies of the code.
If Tansy UI helps you, a visible credit such as "UI by Tansy UI" in your README or site footer is much appreciated. It isn't required.