# @nyxwire/vue 0.1.1

Nyxwire's Vue 3 components: accessible families built on Reka UI and Tailwind CSS v4, in an indigo neon identity.

`@nyxwire/vue` is a Vue 3 component library built on [Reka UI](https://reka-ui.com/), 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.

_Live example: [Vue overview](https://nyxwire.dissidence.ovh/vue/)._

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.

## Conventions

- 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()`](https://nyxwire.dissidence.ovh/tailwind/merging/), 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.

## Install

1. Install the components, the Tailwind theme they are styled with, and Tailwind.

   ```sh
   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](foundations/icons.md).

2. Register the Vue and Tailwind plugins.

   ```ts title="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.

   ```css title="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>`.

   ```vue title="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>
   ```

   ```html title="index.html"
   <html lang="en" data-flavor="nocturne" data-theme="dark"></html>
   ```

## Plugin or named imports

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:

```ts
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.

```ts title="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')
```

## Flavors in Vue

`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](foundations/flavors.md#vue-useflavor) 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](https://nyxwire.dissidence.ovh/tailwind/merging/#in-vue).

## Server rendering and Astro islands

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](https://nyxwire.dissidence.ovh/astro/vue-islands/) has a complete example.

## Component families

| Family                           | Components                                                                                                                                                                                                                                                                                                                                                                                          |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Foundations](composables.md) | `NwProvider`, `NwFlavorSelect`, `useFlavor`, `NyxwirePlugin`, `cn`, `tv`                                                                                                                                                                                                                                                                                                                            |
| [Actions & HUD](families/actions.md)   | `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](families/forms.md)             | `NwLabel`, `NwInput`, `NwInputGroup`, `NwTextarea`, `NwField`, `NwForm`, `NwCheckbox`, `NwCheckboxGroup`, `NwChoiceLabel`, `NwRadioGroup`, `NwSwitch`, `NwSlider`, `NwNumberField`, `NwPinInput`, `NwTagsInput`, `NwEditable`, `NwTagGroup`                                                                                                                                                         |
| [Selection](families/selection.md)     | `NwSelect`, `NwCombobox`, `NwAutocomplete`, `NwListbox`                                                                                                                                                                                                                                                                                                                                             |
| [Date and time](families/datetime.md)  | `NwCalendar`, `NwRangeCalendar`, `NwDateField`, `NwDateRangeField`, `NwTimeField`, `NwTimeRangeField`, `NwDatePicker`, `NwDateRangePicker`, `NwMonthPicker`, `NwMonthRangePicker`, `NwYearPicker`, `NwYearRangePicker`                                                                                                                                                                              |
| [Color](families/color.md)             | `NwColorArea`, `NwColorField`, `NwColorSlider`, `NwColorSwatch`, `NwColorSwatchPicker`, `NwColorPicker`                                                                                                                                                                                                                                                                                             |
| [Overlays](families/overlays.md)       | `NwDialog`, `NwAlertDialog`, `NwSheet`, `NwDrawer`, `NwPopover`, `NwTooltip`, `NwHoverCard`, `NwDropdownMenu`, `NwContextMenu`, `NwMenubar`, `NwToast`, `NwToaster`, `useToast`, `NwCommandPalette`                                                                                                                                                                                                 |
| [Navigation](families/navigation.md)   | `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`.

## Files

Every file below documents @nyxwire/vue 0.1.1. Read the ones you need before writing code.

- [components/accordion.md](components/accordion.md): A stack of sections that expand and collapse, wrapping Reka `Accordion`.
- [components/alert-dialog.md](components/alert-dialog.md): A confirmation that interrupts, wrapping Reka `AlertDialog`.
- [components/alert.md](components/alert.md): `NwAlert` is a native feedback surface with title and description parts.
- [components/aspect-ratio.md](components/aspect-ratio.md): `NwAspectRatio` wraps Reka `AspectRatio` to reserve media space before it loads.
- [components/autocomplete.md](components/autocomplete.md): `NwAutocomplete` wraps Reka `AutocompleteRoot`.
- [components/avatar.md](components/avatar.md): `NwAvatar` wraps Reka `AvatarRoot`, with image and fallback parts.
- [components/badge.md](components/badge.md): `NwBadge` renders Reka `Primitive` as a `span` for a status or category.
- [components/breadcrumb.md](components/breadcrumb.md): The path from the top of a hierarchy to the current page.
- [components/button.md](components/button.md): `NwButton` renders Reka `Primitive` as a native button by default.
- [components/calendar.md](components/calendar.md): `NwCalendar` wraps Reka `CalendarRoot` and fills its default slot with a header (previous, heading, next), a weekday row and one date grid per visible month.
- [components/card.md](components/card.md): `NwCard` and its parts render Reka `Primitive` for a composed content surface.
- [components/checkbox.md](components/checkbox.md): `NwCheckbox` composes Reka `CheckboxRoot` and `CheckboxIndicator` in a chamfered box: a check when checked, a dash when indeterminate.
- [components/chip.md](components/chip.md): `NwChip` is a removable tag: a `span` with the badge face and, when `removeLabel` is set, a native remove button that emits `remove`.
- [components/code.md](components/code.md): `NwCode` renders inline code, or with `block` a `pre` that keeps whitespace and scrolls horizontally.
- [components/collapsible.md](components/collapsible.md): One section that shows and hides, wrapping Reka `Collapsible`.
- [components/color-area.md](components/color-area.md): `NwColorArea` is a two-dimensional picker over two channels of one color space.
- [components/color-field.md](components/color-field.md): `NwColorField` is a text input for a color, wrapping Reka `ColorFieldRoot` and `ColorFieldInput`.
- [components/color-picker.md](components/color-picker.md): `NwColorPicker` is a complete picker behind one button.
- [components/color-slider.md](components/color-slider.md): `NwColorSlider` shows one channel of a color on a gradient track and wraps Reka `ColorSliderRoot` and `ColorSliderThumb`.
- [components/color-swatch-picker.md](components/color-swatch-picker.md): `NwColorSwatchPicker` is a grid of preset swatches with one selected.
- [components/color-swatch.md](components/color-swatch.md): `NwColorSwatch` previews one color over a checkerboard and cannot be interacted with.
- [components/combobox.md](components/combobox.md): `NwCombobox` wraps Reka `ComboboxRoot` so the user can search item text to choose a value.
- [components/command-palette.md](components/command-palette.md): A Nyxwire-only composite: a dialog with a search field over a filtered list of commands, built from `NwDialog` parts and Reka `Listbox`.
- [components/context-menu.md](components/context-menu.md): The same menu opened by a right-click (or a long press) on an area, wrapping Reka `ContextMenu`.
- [components/data-table.md](components/data-table.md): `NwDataTable` builds an `NwTable` from typed rows and column accessors and sorts them itself.
- [components/date-field.md](components/date-field.md): `NwDateField` wraps Reka `DateFieldRoot` and renders one `NwDateFieldInput` per segment, in the order the provider's locale uses.
- [components/date-picker.md](components/date-picker.md): `NwDatePicker` wraps Reka `DatePickerRoot`.
- [components/date-range-field.md](components/date-range-field.md): `NwDateRangeField` wraps Reka `DateRangeFieldRoot`.
- [components/date-range-picker.md](components/date-range-picker.md): `NwDateRangePicker` wraps Reka `DateRangePickerRoot`.
- [components/dialog.md](components/dialog.md): A modal window for a focused task, wrapping Reka `Dialog`.
- [components/drawer.md](components/drawer.md): A swipeable panel, wrapping Reka `Drawer`.
- [components/dropdown-menu.md](components/dropdown-menu.md): A menu of actions opened from a button, wrapping Reka `DropdownMenu`, with items, checkbox and radio items, labels, groups, separators, shortcuts and submenus.
- [components/editable.md](components/editable.md): `NwEditable` wraps Reka `EditableRoot` for an inline preview/edit cycle.
- [components/empty.md](components/empty.md): `NwEmpty` is the placeholder for a collection with no items: a title, an optional description and a slot for the next action.
- [components/field.md](components/field.md): `NwField` wraps Reka `FieldRoot`.
- [components/form.md](components/form.md): `NwForm` wraps Reka `FormRoot` to collect named fields, validate on submit and focus the first invalid control.
- [components/hover-card.md](components/hover-card.md): A preview card for sighted pointer users, wrapping Reka `HoverCard`: it opens after the pointer rests on the trigger (700 ms) and closes 300 ms after it leaves.
- [components/hud-panel.md](components/hud-panel.md): `NwHudPanel` renders Reka `Primitive` as a `section` with a cut-corner frame, a header label and a status readout; `NwNeonText` renders it as a `span`.
- [components/icon-button.md](components/icon-button.md): `NwIconButton` is an `NwButton` with `icon` set and a required `label`, which becomes both its `aria-label` and its tooltip-style `title`.
- [components/input-group.md](components/input-group.md): `NwInputGroup` wraps Reka `Primitive` to join inputs and `NwInputGroupAddon` text into one bar: inner corners square off, borders collapse and the focused input rises above its neighbours.
- [components/input.md](components/input.md): `NwLabel` wraps Reka `Label`.
- [components/kbd.md](components/kbd.md): `NwKbd` is a native `kbd` keycap.
- [components/key-hint.md](components/key-hint.md): `NwKeyHint` composes keycaps joined by a decorative plus and an action label in a `span`.
- [components/layout.md](components/layout.md): `NwLayout` is a `div` that arranges its children with one of the four layout primitives of the CSS layer.
- [components/link.md](components/link.md): `NwLink` renders Reka `Primitive` as an anchor.
- [components/list.md](components/list.md): `NwList` renders a styled `ul` or `ol`, from an `items` array or from your own `li` elements.
- [components/listbox.md](components/listbox.md): `NwListbox` wraps Reka `ListboxRoot` for a list that stays visible.
- [components/menubar.md](components/menubar.md): A horizontal row of menus, as in a desktop application, wrapping Reka `Menubar`.
- [components/meter.md](components/meter.md): `NwMeter` is a native `<meter>` for a measurement within a known range (disk use, load), as opposed to task progress.
- [components/month-picker.md](components/month-picker.md): `NwMonthPicker` wraps Reka `MonthPickerRoot`.
- [components/month-range-picker.md](components/month-range-picker.md): `NwMonthRangePicker` wraps Reka `MonthRangePickerRoot` and selects a start month and an end month.
- [components/navbar.md](components/navbar.md): A Nyxwire-only application bar: a `<nav>` landmark with a brand, a row of links and an actions area, underlined by a wire hairline.
- [components/navigation-menu.md](components/navigation-menu.md): Site navigation with dropdown panels, wrapping Reka `NavigationMenu`.
- [components/number-field.md](components/number-field.md): `NwNumberField` wraps Reka `NumberFieldRoot` and supplies decrement, input and increment parts by default.
- [components/pagination.md](components/pagination.md): Page controls for a long list, wrapping Reka `Pagination`.
- [components/pin-input.md](components/pin-input.md): `NwPinInput` wraps Reka `PinInputRoot`.
- [components/popover.md](components/popover.md): A non-modal, cut-corner panel anchored to its trigger, wrapping Reka `Popover`.
- [components/progress.md](components/progress.md): `NwProgress` wraps Reka `ProgressRoot` and supplies the `ProgressIndicator`.
- [components/provider.md](components/provider.md): `NwProvider` wraps Reka's `ConfigProvider`, `TooltipProvider` and `ToastProvider`, and renders one `div` that carries the scope.
- [components/radio-group.md](components/radio-group.md): `NwRadioGroup` wraps Reka `RadioGroupRoot`; `NwRadioGroupItem` composes `RadioGroupItem`, `RadioGroupIndicator` and a label for its text slot.
- [components/range-calendar.md](components/range-calendar.md): `NwRangeCalendar` wraps Reka `RangeCalendarRoot` with the same grid layout and selects a start and an end date.
- [components/rating.md](components/rating.md): `NwRating` composes Reka `RatingRoot`, `RatingItem` and `RatingItemIndicator`.
- [components/scroll-area.md](components/scroll-area.md): A scroll container with themed, overlay scrollbars, wrapping Reka `ScrollArea`.
- [components/select.md](components/select.md): `NwSelect` wraps Reka `SelectRoot`.
- [components/separator.md](components/separator.md): `NwSeparator` wraps Reka `Separator` for horizontal or vertical division, optionally with a centered label.
- [components/sheet.md](components/sheet.md): A dialog docked to an edge of the viewport, for settings and secondary panels.
- [components/sidenav.md](components/sidenav.md): A Nyxwire-only vertical navigation for an application or docs sidebar: a `<nav>` landmark holding lists of links, optionally split into labelled groups.
- [components/skeleton.md](components/skeleton.md): `NwSkeleton` renders Reka `Primitive` as an `aria-hidden` placeholder with a primary shimmer.
- [components/slider.md](components/slider.md): `NwSlider` wraps Reka `SliderRoot` and supplies a sunken track, a wire-gradient range and one glowing diamond thumb per value.
- [components/spinner.md](components/spinner.md): `NwSpinner` is a native `span` with `role="status"` and a visually hidden label, or a decorative span when another element owns the announcement, as in `NwButton`'s `loading` state.
- [components/splitter-group.md](components/splitter-group.md): Resizable panels, wrapping Reka `Splitter`.
- [components/stat.md](components/stat.md): `NwStat` is a description list (`dl`) that pairs a label with a headline value and an optional detail line.
- [components/stepper.md](components/stepper.md): Progress through ordered steps, wrapping Reka `Stepper`.
- [components/switch.md](components/switch.md): `NwSwitch` wraps Reka `SwitchRoot` and supplies `SwitchThumb`: a chamfered track with a square thumb, filled and glowing in the intent ink when on.
- [components/table.md](components/table.md): `NwTable` and its parts render Reka `Primitive` with native table elements.
- [components/tabs.md](components/tabs.md): Switches between panels in place, wrapping Reka `Tabs`.
- [components/tag-group.md](components/tag-group.md): `NwTagGroup` wraps Reka `TagGroupRoot` for selecting and removing existing tags.
- [components/tags-input.md](components/tags-input.md): `NwTagsInput` wraps Reka `TagsInputRoot` for editing a list of values.
- [components/textarea.md](components/textarea.md): `NwTextarea` renders a native textarea through Reka `Primitive`, or `FieldControl` inside a field, with three rows by default.
- [components/time-field.md](components/time-field.md): `NwTimeField` wraps Reka `TimeFieldRoot` and renders an `NwTimeFieldInput` for each formatted time segment.
- [components/time-range-field.md](components/time-range-field.md): `NwTimeRangeField` wraps Reka `TimeRangeFieldRoot` for a start time and an end time, separated by an en dash.
- [components/toaster.md](components/toaster.md): Short, non-blocking notifications, built on Reka `Toast`.
- [components/toggle.md](components/toggle.md): `NwToggle` wraps Reka `Toggle` for a pressed state.
- [components/toolbar.md](components/toolbar.md): `NwToolbar` wraps Reka `ToolbarRoot` to group related commands into one tab stop.
- [components/tooltip.md](components/tooltip.md): A short label shown on hover or keyboard focus, wrapping Reka `Tooltip`.
- [components/tree.md](components/tree.md): A hierarchical list, wrapping Reka `Tree`.
- [components/year-picker.md](components/year-picker.md): `NwYearPicker` wraps Reka `YearPickerRoot` for values that only need a year, such as a fiscal or archive year.
- [components/year-range-picker.md](components/year-range-picker.md): `NwYearRangePicker` wraps Reka `YearRangePickerRoot` and selects a start year and an end year.
- [composables.md](composables.md): The full API of useFlavor, useToast, useNyxwireTheme, useNwFieldControl, cn, tv and NyxwirePlugin from @nyxwire/vue.
- [families/actions.md](families/actions.md): Buttons, toggles, display components, feedback, data and HUD surfaces of @nyxwire/vue, with live examples and source-backed API references.
- [families/color.md](families/color.md): NwColorPicker, NwColorArea, NwColorSlider, NwColorField, NwColorSwatch and NwColorSwatchPicker, Reka's color primitives drawn in the page with Nyxwire's wire edges and cut swatches.
- [families/datetime.md](families/datetime.md): Calendars, segmented date and time fields, popup date pickers and month and year grids for Vue, built on Reka and @internationalized/date values.
- [families/forms.md](families/forms.md): Text fields, field wiring, validation, choice controls and structured input, with live Vue islands, anatomy and API tables.
- [families/navigation.md](families/navigation.md): Tabs, accordions, collapsibles, navigation menus, pagination, breadcrumbs, steppers, trees, scroll areas, splitters, navbars and sidenavs from @nyxwire/vue, built on Reka UI.
- [families/overlays.md](families/overlays.md): Dialogs, alert dialogs, sheets, drawers, popovers, tooltips, hover cards, dropdown and context menus, menubars, toasts and the command palette from @nyxwire/vue, all rendered in the page through Reka portals.
- [families/selection.md](families/selection.md): Selects, searchable comboboxes, free-text autocomplete and persistent listboxes for Vue, drawn in the page with Nyxwire's wire-edge focus.
- [foundations/accessibility.md](foundations/accessibility.md): The palette's contrast gate with live results, focus rings, keyboard support, reduced motion and forced-colors fallbacks.
- [foundations/color-roles.md](foundations/color-roles.md): Semantic color tokens, what each accent means, and the syntax highlighting roles, generated from @nyxwire/palette.
- [foundations/effects-motion.md](foundations/effects-motion.md): Cut corners, the wire edge, neon glow, scanlines, the circuit grid, glitch, glass, and motion tokens that respect reduced motion.
- [foundations/flavors.md](foundations/flavors.md): Pick a flavor with data attributes, nest scopes, swap the accent, and persist the visitor's choice without a flash.
- [foundations/icons.md](foundations/icons.md): Lucide icons through @lucide/vue, sized by the component around them and hidden from assistive technology unless they carry meaning.
- [foundations/palette.md](foundations/palette.md): Every Nyxwire color in all four flavors, generated from @nyxwire/palette with hex, RGB, OKLCH and contrast against the flavor's base.
- [foundations/spacing-elevation.md](foundations/spacing-elevation.md): The 0.25rem spacing grid, radius and cut scale, control heights, surface ramp, shadows and z-index layers.
- [foundations/typography.md](foundations/typography.md): Three bundled variable fonts, the type scale, heading roles and the typography classes.
