Skip to main content
This guide shows developers how to implement consistent, accessible data tables in the DeployStack frontend.

Quick Implementation

Basic Table Structure

shadcn-vue Table Components

Required Components

Component Structure

  • Table - Main table wrapper
  • TableHeader - Table header section
  • TableBody - Table body section
  • TableRow - Table row (for both header and body)
  • TableHead - Header cell
  • TableCell - Data cell

Design Patterns

1. Container Structure

2. Header Pattern

3. Empty State Handling

4. Data Cell Patterns

Primary Content (Names, Titles):
Secondary Content (Descriptions, Metadata):
Status Indicators:
Dates and Timestamps:

Action Menu Pattern

For table actions, use DropdownMenu with AlertDialog for destructive actions.

Rules

RuleDoDon’t
Action iconMoreVerticalMoreHorizontal
Actions headerEmpty <TableHead>”Actions” text
Column widthw-[50px]w-[100px] or wider
Dropdown alignmentalign="end"align="start"
Destructive actionstext-destructive classDefault styling

Implementation

Badge Patterns for Tables

Status Badges

Category/Tag Badges

Numeric Badges

Adding Pagination

Tables with large datasets should use the PaginationControls component. Place it below the table container.
For full implementation details including service layer setup, row selection support, and responsive behavior, see the Pagination Guide.

Migration from Raw HTML

❌ Deprecated Pattern - Raw HTML Tables

✅ Preferred Pattern - shadcn-vue Components

Migration Steps

  1. Replace HTML elements with shadcn-vue components:
    • <table><Table>
    • <thead><TableHeader>
    • <tbody><TableBody>
    • <tr><TableRow>
    • <th><TableHead>
    • <td><TableCell>
  2. Update imports:
  3. Add proper empty state handling
  4. Update action menus to use AlertDialog for destructive actions
  5. Ensure proper badge usage for status indicators

Required Translations

Add to your i18n file: