Skip to main content
Version: v1 (Current)

Components Overview

The UI Kit provides three categories of functionality:

UI Primitives

Low-level, accessible components from shadcn-vue. These are unstyled by default and themed via CSS variables.

Available Components

ComponentDescription
AccordionCollapsible sections
AlertAlert messages
AlertDialogConfirmation dialog
AspectRatioAspect ratio container
AvatarUser avatar
BadgeStatus badge
ButtonClickable button with variants and sizes
CalendarDate picker
CardContent container
CheckboxCheckbox input
CollapsibleCollapsible content
CommandCommand palette
ContextMenuRight-click menu
DialogModal dialog with overlay
DropdownMenuContext menu
FormForm wrapper with validation
HoverCardHover preview
InputText input with v-model support
LabelForm label
MenubarTop menubar
NavigationMenuSite navigation
PaginationPage navigation
PopoverFloating content
ProgressProgress indicator
RadioGroupRadio button group
ScrollAreaCustom scrollbar
SelectDropdown select input
SeparatorVisual divider
SheetSide panel
SkeletonLoading placeholder
SliderRange slider
SwitchToggle switch
TableData table
TabsTabbed navigation
TextareaMultiline text input
Toaster (Sonner)Toast notifications
TooltipHover tooltip

Domain Components

Platform-specific components designed for GXP platform use cases.

Available Components

ComponentDescription
ActivityNotificationsToast notification system for activity events
AudioVisualizerFrequency bars and waveform timeline via Web Audio API
AwardIconSVG award/medal icon
BarcodeScannerQR/barcode scanning using Quagga2 with dynamic import
CountdownIdle timeout countdown with user interaction detection
FileUploaderFile upload with image processing and multi-file support
HeaderPage header with background image, logo, and video support
LeaderboardRanked list with placeholders, top-3 styling, and animations
SpinnerLoading spinner with sm/md/lg sizes
VideoPlayerHTML5 video player with TypeScript props and events

Composables

Reusable composition functions for common platform functionality.

Available Composables

ComposableDescription
useAnimationsPage transition animations with animate.css
useErrorsShared error message state management
useMediaVideo/audio recording, device management, canvas processing
useNfcListenerNFC scan event handler via window.postMessage
useScanningBarcode/QR scan state management

Component Architecture

File Structure

Each component follows this structure:

src/components/ui/<component-name>/
├── ComponentName.vue # Main component
├── index.ts # Exports
├── ComponentName.test.ts # Unit tests
└── ComponentName.stories.ts # Storybook stories

For domain components:

src/components/domain/<component-name>/
├── ComponentName.vue # Main component
├── index.ts # Exports
├── ComponentName.test.ts # Unit tests
└── ComponentName.stories.ts # Storybook stories

Naming Conventions

  • PascalCase for component names: Button.vue, VideoPlayer.vue
  • kebab-case for directories: video-player/, barcode-scanner/
  • Type exports suffixed with type: ButtonVariants, InputProps

Props Pattern

Components use TypeScript interfaces for props:

interface Props {
variant?: 'default' | 'secondary' | 'destructive'
size?: 'default' | 'sm' | 'lg'
disabled?: boolean
class?: string
}

Event Pattern

Components emit typed events:

const emit = defineEmits<{
(e: 'click', event: MouseEvent): void
(e: 'update:modelValue', value: string): void
}>()

Using Components

Basic Import

import { Button, Input, VideoPlayer } from '@gxp-dev/uikit'

With Types

import { Button, type ButtonVariants } from '@gxp-dev/uikit'

Using Composables

import { useMedia, useScanning } from '@gxp-dev/uikit'

const { startRecording, stopRecording } = useMedia()
const { startScanning, stopScanning } = useScanning()

Accessing Variant Functions

Some components export variant functions for advanced styling:

import { buttonVariants } from '@gxp-dev/uikit'

// Use in custom component
const classes = buttonVariants({ variant: 'secondary', size: 'lg' })

Customizing Components

Via Props

<Button variant="secondary" size="lg" class="custom-class">
Custom Button
</Button>

Via CSS Variables

Override the theme CSS variables:

:root {
--primary: #your-color;
--primary-foreground: #your-text-color;
}

Via Tailwind

Add custom classes that merge with defaults:

<Button class="rounded-full shadow-lg">
Rounded Shadow Button
</Button>

Accessibility

All UI primitives from shadcn-vue are built on Reka UI, which provides:

  • Keyboard navigation - Full keyboard support
  • Focus management - Proper focus handling
  • ARIA attributes - Semantic accessibility
  • Screen reader support - Announced correctly

Storybook

Explore components interactively:

pnpm storybook

Each component has stories demonstrating:

  • All variants and sizes
  • Interactive controls
  • Edge cases
  • Accessibility features