Skip to main content

Shared UI Component Library

All reusable UI primitives live under src/shared/components/ui/. These components ensure consistent visual style, accessibility, and interaction patterns across every feature.


Component Catalog​

ComponentFile PathUsage & Props
Buttonshared/components/ui/Button.tsxStandard button with variants (primary, secondary, danger, outline, ghost), loading spinners, and disabled states.
Modalshared/components/ui/Modal.tsxHeadless UI-powered accessible dialog with backdrop, title, custom width, and close button.
Steppershared/components/ui/Stepper.tsxMulti-step progress bar indicator used in Wizards.
SearchBarshared/components/ui/SearchBar.tsxInput with search icon, clear button, and debounce integration.
SearchableSelectshared/components/ui/SearchableSelect.tsxFilterable dropdown selector for selecting employees, departments, or roles.
DataTableshared/components/DataTable.tsxSortable data table with empty states, loading skeletons, and sticky headers.
CollapsibleSectionshared/components/ui/CollapsibleSection.tsxAccordion section card with chevron toggle and smooth height transitions.
PageHeadershared/components/ui/PageHeader.tsxStandard page header with title, subtitle, breadcrumbs, and right-aligned CTA buttons.
PageToggleshared/components/PageToggle.tsxSegmented pill tab switcher (e.g. My Timesheets vs Team Timesheets).
EmptyStateshared/components/ui/EmptyState.tsxIllustrated empty placeholder with title, description, and optional action button.
LoadingSpinnershared/components/ui/LoadingSpinner.tsxCentered CSS spinner for route and card loading fallbacks.
Tooltipshared/components/Tooltip.tsxHover tooltip for truncations and icon explanation badges.

Code Examples​

1. Button Component​

import Button from '@/shared/components/ui/Button';
import { Plus } from 'lucide-react';

<Button
variant="primary"
size="md"
isLoading={isSubmitting}
leftIcon={<Plus className="w-4 h-4" />}
onClick={handleCreate}>
Create Employee
</Button>

2. Modal Component​

import Modal from '@/shared/components/ui/Modal';
import Button from '@/shared/components/ui/Button';

<Modal
isOpen={isOpen}
onClose={() => setIsOpen(false)}
title="Confirm Action"
size="md">
<div className="p-4 space-y-4">
<p>Are you sure you want to approve this request?</p>
<div className="flex justify-end gap-2">
<Button variant="secondary" onClick={() => setIsOpen(false)}>Cancel</Button>
<Button variant="primary" onClick={handleConfirm}>Confirm</Button>
</div>
</div>
</Modal>

3. Stepper Component​

import Stepper from '@/shared/components/ui/Stepper';

const steps = ['Personal Info', 'Job & Role', 'Compensation', 'Review'];

<Stepper
steps={steps}
currentStep={currentStep}
onStepClick={(stepIndex) => setCurrentStep(stepIndex)}
/>