Skip to content

Vue overview

@nyxwire/vue is a Vue 3 component library built on Reka UI, the headless primitives that provide keyboard support, focus management and ARIA. Every component is styled with the Nyxwire Tailwind theme, so it matches the corresponding nw-* CSS class and follows the flavor and accent of its scope.

preference auto · resolved nocturne · theme dark

This is NwFlavorSelect driven by useFlavor(), hydrated as an Astro island. Change it and the header picker follows, because both talk to the same page runtime.

  • Every export is prefixed Nw, and compound components mirror Reka’s anatomy: NwSelect, NwSelectTrigger, NwSelectContent, NwSelectItem.
  • Components that wrap a Reka primitive forward its props and events, so v-model, as-child and the Reka options work as Reka documents them.
  • Styled components share the appearance props of the CSS classes: intent (primary, secondary, tertiary, neutral, info, success, warning, danger), variant (solid, soft, outline, ghost, link) and size (xs to lg), plus the Nyxwire motifs cut (chamfered corners), wire (gradient edge) and glow (sm, md, lg).
  • Every component that takes class merges it with cn(), so your utilities replace the component’s own instead of fighting them.
  • Popups (select lists, menus, popovers, tooltips, dialogs, toasts) render in the page through Reka portals, never as browser-drawn popups.
  1. Install the components, the Tailwind theme they are styled with, and Tailwind.

    Terminal window
    pnpm add @nyxwire/vue @nyxwire/tailwind vue
    pnpm add -D tailwindcss @tailwindcss/vite @vitejs/plugin-vue

    Reka UI, tailwind-variants, tailwind-merge, @lucide/vue, @vueuse/core and @internationalized/date are dependencies of the package; Vue 3.5 or later and Tailwind CSS 4 are peer dependencies. Add @lucide/vue to your own dependencies too if your code imports icons.

  2. Register the Vue and Tailwind plugins.

    vite.config.ts
    import { defineConfig } from 'vite'
    import vue from '@vitejs/plugin-vue'
    import tailwindcss from '@tailwindcss/vite'
    export default defineConfig({ plugins: [vue(), tailwindcss()] })
  3. Import Tailwind, the theme, and the component sources in your stylesheet.

    src/style.css
    @import 'tailwindcss';
    @import '@nyxwire/tailwind';
    @import '@nyxwire/vue/tailwind.css';

    The second line brings the tokens, the four flavors and the bundled fonts. The last line is an @source for the package’s built files, so Tailwind generates every class the components use. The components do not need the plain @nyxwire/css component classes.

  4. Wrap the app in NwProvider and set a flavor on <html>.

    src/App.vue
    <script setup lang="ts">
    import { NwButton, NwFlavorSelect, NwProvider, useFlavor } from '@nyxwire/vue'
    const { resolvedFlavor, setFlavor } = useFlavor()
    </script>
    <template>
    <NwProvider>
    <NwFlavorSelect :model-value="resolvedFlavor" @update:model-value="setFlavor" />
    <NwButton cut>Deploy</NwButton>
    </NwProvider>
    </template>
    index.html
    <html lang="en" data-flavor="nocturne" data-theme="dark"></html>

NwProvider wraps Reka’s ConfigProvider, TooltipProvider and ToastProvider, and renders one div that carries the scope. Put one at the root of every Vue app, and one in every Astro island, since each island is its own app.

Prop Default Effect
v-model:flavor inherited Scopes a flavor to the subtree with data-flavor on the provider’s wrapper
v-model:accent inherited Scopes an accent to the subtree with data-accent (indigo, volt, ice…)
dir 'ltr' Reading direction for every Reka primitive, also set as dir on the wrapper
locale 'en' Locale for every Reka primitive, dates included, also set as lang
tooltipDelay 300 Tooltip open delay in ms
toastDuration 5000 How long a toast stays visible, in ms

A provider without flavor or accent inherits the nearest outer provider, or the flavor set on the document. Overlays read the nearest provider even when their content teleports out of the subtree, so a dialog opened from a twilight panel is twilight too. Other attributes (class, id, data-*) land on the wrapper. The provider also hands Vue’s useId to Reka, so generated ids match between the server render and hydration, and it owns the toast queue that useToast() and NwToaster share.

<NwProvider flavor="lumen" accent="volt" class="rounded-lg p-6">
<NwButton>Light preview with a volt accent</NwButton>
</NwProvider>

Import components where you use them. The package ships one ES module per component and marks only its CSS as a side effect, so a bundler keeps just what you import:

import {
NwSelect,
NwSelectContent,
NwSelectItem,
NwSelectTrigger,
NwSelectValue,
} from '@nyxwire/vue'

NyxwirePlugin registers every Nw* component globally instead. It suits prototypes; it also pulls every component into the bundle.

src/main.ts
import { createApp } from 'vue'
import { NyxwirePlugin } from '@nyxwire/vue'
import App from './App.vue'
import './style.css'
createApp(App).use(NyxwirePlugin).mount('#app')

useFlavor() reads and sets the flavor: it returns flavor (the preference, auto included), resolvedFlavor, isDark, flavors and setFlavor(). It shares the nyxwire-flavor storage key and the nyxwire:flavor event with every other package; Flavors & theming covers the composable and its options.

NwFlavorSelect is its picker: a labelled native <select> listing abyss, nocturne, twilight and lumen. Bind it with v-model; without a model it shows the provider’s flavor, then nocturne.

NwFlavorSelect prop Default Effect
v-model unset Selected flavor; emits update:modelValue
label 'Flavor' Visible label, tied to the select by id
disabled false Disables the select

The package also exports cn and tv, configured with the Nyxwire merge rules: see Class merging.

The components render on the server. useFlavor touches neither window nor document until a component mounts, and ids come from Vue’s useId. In Astro, each client:* component is a separate Vue app: wrap its content in NwProvider, and use client:visible unless the component is interactive above the fold. When the page has a flavor runtime (window.nyxwire, installed by the Astro integration or the Starlight plugin), useFlavor delegates to it, which is how the island above follows the header. Vue islands has a complete example.

Family Components
Foundations NwProvider, NwFlavorSelect, useFlavor, NyxwirePlugin, cn, tv
Actions & HUD NwButton, NwButtonGroup, NwIconButton, NwToggle, NwToggleGroup, NwToolbar, NwBadge, NwChip, NwKbd, NwKeyHint, NwCard, NwSeparator, NwAvatar, NwAspectRatio, NwSkeleton, NwSpinner, NwAlert, NwLink, NwProgress, NwMeter, NwRating, NwTable, NwDataTable, NwStat, NwHudPanel, NwStatBar, NwNeonText, NwCode, NwList, NwEmpty, NwLayout
Forms NwLabel, NwInput, NwInputGroup, NwTextarea, NwField, NwForm, NwCheckbox, NwCheckboxGroup, NwChoiceLabel, NwRadioGroup, NwSwitch, NwSlider, NwNumberField, NwPinInput, NwTagsInput, NwEditable, NwTagGroup
Selection NwSelect, NwCombobox, NwAutocomplete, NwListbox
Date and time NwCalendar, NwRangeCalendar, NwDateField, NwDateRangeField, NwTimeField, NwTimeRangeField, NwDatePicker, NwDateRangePicker, NwMonthPicker, NwMonthRangePicker, NwYearPicker, NwYearRangePicker
Color NwColorArea, NwColorField, NwColorSlider, NwColorSwatch, NwColorSwatchPicker, NwColorPicker
Overlays NwDialog, NwAlertDialog, NwSheet, NwDrawer, NwPopover, NwTooltip, NwHoverCard, NwDropdownMenu, NwContextMenu, NwMenubar, NwToast, NwToaster, useToast, NwCommandPalette
Navigation NwTabs, NwAccordion, NwCollapsible, NwNavigationMenu, NwPagination, NwBreadcrumb, NwStepper, NwTree, NwScrollArea, NwSplitterGroup, NwNavbar, NwSidenav

Each family also exports the compound parts of its components, such as NwTabsList, NwTabsTrigger and NwTabsContent.