An accessibility-first UI component library for React and Vue, built on top of HeadlessUI with opinionated styling using Tailwind CSS.
This is a monorepo containing three packages:
Framework-agnostic package containing:
- Shared variant definitions (using
tailwind-variants) - Utility functions (e.g.,
cnfor className merging) - Shared TypeScript types
- Design tokens and constants
React implementation using @headlessui/react
Vue 3 implementation using @headlessui/vue
davis/
├── packages/
│ ├── core/ # Shared variants and utilities
│ ├── react/ # React components
│ └── vue/ # Vue components
├── package.json # Root workspace config
└── tsconfig.base.json # Shared TypeScript config
- Node.js 18+
- npm 9+ (for workspace protocol support)
npm install# Build all packages
npm run build
# Build in watch mode
npm run dev
# Type check all packages
npm run typecheck# Build only React package
npm run build -w @libretexts/davis-react
# Build only Vue package
npm run build -w @libretexts/davis-vue
# Build only core package
npm run build -w @libretexts/davis-core- Accessibility First: Built on HeadlessUI for rock-solid a11y foundations
- Customizable: Tailwind-based styling allows easy customization
- Type-safe: Full TypeScript support across all packages
- Framework Agnostic Core: Share variant definitions between React and Vue
- Tree-shakeable: Optimized bundle size with ESM and proper exports
// packages/core/src/variants/my-component.ts
import { tv, type VariantProps } from "tailwind-variants";
export const myComponentVariants = tv({
base: "...",
variants: {
// variant classes
},
defaultVariants: {
// defaults
},
});
export type MyComponentVariantProps = VariantProps<typeof myComponentVariants>;// packages/core/src/index.ts
export { myComponentVariants } from "./variants/my-component";
export type { MyComponentVariantProps } from "./variants/my-component";// packages/react/src/components/MyComponent.tsx
import {
cn,
myComponentVariants,
type MyComponentVariantProps,
} from "@libretexts/davis-core";
export interface MyComponentProps extends MyComponentVariantProps {
// component-specific props
}
export const MyComponent = ({
variant,
size,
className,
...props
}: MyComponentProps) => {
return (
<div className={cn(myComponentVariants({ variant, size }), className)}>
{/* implementation */}
</div>
);
};<!-- packages/vue/src/components/MyComponent.vue -->
<script setup lang="ts">
import {
cn,
myComponentVariants,
type MyComponentVariantProps,
} from "@libretexts/davis-core";
interface MyComponentProps extends MyComponentVariantProps {
// component-specific props
}
const props = defineProps<MyComponentProps>();
</script>
<template>
<div
:class="
cn(
myComponentVariants({ variant: props.variant, size: props.size }),
props.className,
)
"
>
<!-- implementation -->
</div>
</template>MIT © LibreTexts, Inc.
