cornet-ui
| Install | |
|---|---|
npm install cornet-ui |
|
| Latest Version: | 0.1.0-beta.33 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Oct 22, 2026 |
| Links: | Repository · npm |
Cornet — source reference
This is the source branch of Cornet, a Vue 3 component library built on DaisyUI 5 and Tailwind CSS 4.
You are reading this because you either:
- added
libas a Git submodule and want to understand or modify the source - are contributing to the library
For installation instructions and usage examples, see the main README or cornet-ui.com.
Repository layout
lib/
├── index.ts # Single entry point — re-exports everything
├── index.css # CSS entry (@source inline safelist)
├── plugin-vite.ts # Optional Vite plugin (CSS tree-shaking)
├── types/
│ └── index.ts # Auto-generated — run `npm run generate:types`
├── composables/
│ ├── useSizeProps.ts # size prop → DaisyUI modifier class
│ └── useVariantProps.ts # variant prop → DaisyUI color class
└── components/
├── Actions/ # DuButton, DuDropdown, DuModal, DuSwap, DuFab
├── DataDisplay/ # DuCard, DuTable, DuBadge, DuAvatar, …
├── DataInput/ # DuSelect, DuInputField, DuCheckbox, …
├── Feedback/ # DuAlert, DuToast, DuLoading, …
├── Layout/ # DuDrawer, DuJoin
└── Navigation/ # DuMenu, DuNavbar, DuTabs, DuPagination, …
Component anatomy
Every component lives in components/{Category}/du-{name}/ and always consists of exactly three files:
du-{name}.vue # The Vue component (Composition API, <script setup>)
du-{name}.types.ts # TypeScript types and DaisyUI class constants
du-{name}.stories.ts # Storybook stories
Example — DuButton
du-button.types.ts — declares the DaisyUI class lists and derives TypeScript types from them:
export const BUTTON_SIZES = ['btn-xs', 'btn-sm', 'btn-md', 'btn-lg', 'btn-xl'] as const
export type BUTTONSize = (typeof BUTTON_SIZES)[number]
du-button.vue — uses withDefaults(defineProps<{...}>(), {...}), applies composables for size and variant, then assembles the class list on a dynamic <component :is="...">:
<script setup lang="ts">
const { sizeClass } = useSizeMapping(props, 'btn')
const { colorClass } = useVariantMapping(props, 'btn')
</script>
<template>
<component :is="elementTag" :class="['btn', sizeClass, colorClass, ...]">
<slot />
</component>
</template>
du-button.stories.ts — standard Storybook meta + story objects, reusing the composable controls:
argTypes: {
...useVariantStoriesControl,
...useSizeStoriesControl,
}
Composables
Two composables handle the two props shared by almost every component.
useSizeMapping(props, suffix)
Maps size: Size → a DaisyUI modifier class.
// useSizeMapping(props, 'btn') with size='lg' → 'btn-lg'
// useSizeMapping(props, 'badge') with size='sm' → 'badge-sm'
// size='default' → '' (no class added)
const { sizeClass } = useSizeMapping(props, 'btn')
Size = 'default' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
useVariantMapping(props, suffix)
Maps variant: Variant → a DaisyUI color class.
// useVariantMapping(props, 'btn') with variant='primary' → 'btn-primary'
// variant='default' → '' (no class added)
const { colorClass } = useVariantMapping(props, 'btn')
Variant = 'default' | 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'
Both composables also export useSizeStoriesControl / useVariantStoriesControl — ready-made Storybook argTypes objects to spread into stories.
Adding a component
- Create the three files in
components/{Category}/du-{name}/ - Types file — declare your DaisyUI class constants and derive types from them
- Vue file — use
useSizeMapping/useVariantMappingforsize/variant; default them to'default' - Stories file — spread
useSizeStoriesControlanduseVariantStoriesControlintoargTypes - Export the component from
index.ts - Regenerate types:
npm run generate:types— this updatestypes/index.ts; CI fails on drift
Dev commands
npm install
npm run dev # Storybook (component development)
npm run lint # ESLint (flat config)
npm run type-check # vue-tsc strict
npm test # Vitest
npm run build # Production build (dist/ + declaration emit)
npm run generate:types # Regenerate types/index.ts
Modifying a component (submodule workflow)
When lib is a submodule in your project, changes you make here are local by default. To share them upstream:
- Work in
lib/, commit there on its own branch - Open a merge request on GitLab or a PR on GitHub
- Once merged, update the submodule pointer in the parent project
See CONTRIBUTING.md for conventions and the release process.
License
Related Packages
The design system behind Hikarinagi: Vue 3 components built on Tailwind CSS v4.
Version History
Pre-releases (27)
| Version | Released | License |
|---|---|---|
| 0.1.0-beta.33 | MIT | |
| 0.1.0-beta.32 | MIT | |
| 0.1.0-beta.31 | MIT | |
| 0.1.0-beta.30 | MIT | |
| 0.1.0-beta.29 | MIT | |
| 0.1.0-beta.28 | MIT | |
| 0.1.0-beta.27 | MIT | |
| 0.1.0-beta.26 | MIT | |
| 0.1.0-beta.25 | MIT | |
| 0.1.0-beta.24 | MIT | |
| 0.1.0-beta.23 | MIT | |
| 0.1.0-beta.22 | MIT | |
| 0.1.0-beta.21 | MIT | |
| 0.1.0-beta.19 | MIT | |
| 0.1.0-beta.18 | MIT | |
| 0.1.0-beta.16 | MIT | |
| 0.1.0-beta.15 | MIT | |
| 0.1.0-beta.14 | MIT | |
| 0.1.0-beta.13 | MIT | |
| 0.1.0-beta.11 | MIT | |
| 0.1.0-beta.10 | MIT | |
| 0.1.0-beta.9 | MIT | |
| 0.1.0-beta.8 | MIT | |
| 0.1.0-beta.6 | MIT | |
| 0.1.0-beta.5 | MIT | |
| 0.1.0-beta.4 | MIT | |
| 0.1.0-beta.1 | MIT |