UIPackage
Menu

Framework

Change language

Boilerplate repo

Table

tableui

Plain HTML table primitives — `<Table>`, `<TableHeader>`, `<TableRow>`, `<TableCell>` — with the registry’s borders, padding, and tokens already applied. Use this when Data Table is too heavy.

Also available for React ->

Installation

$npx shadcn-vue@latest add https://uipkge.dev/r/vue/table.json
Named registry:npx shadcn-vue@latest add @uipkge/tableInstalls to:app/components/ui/table/

Examples

Loading interactive previews…

Props

NameType / ValuesDefaultRequired
classHTMLAttributes['class']optional
containerClass

wrapper around <Table> breaks stickiness, so size the scroller here.

HTMLAttributes['class']optional
density
'compact''cozy''comfortable'
optional

Used by

Files installed (11)

  • app/components/ui/table/Table.vue1.4 kB
    <script setup lang="ts">
    import type { HTMLAttributes } from 'vue'
    import { computed } from 'vue'
    import { cn } from '@/lib/utils'
    
    // Match DataTable's density enum so consumers can opt into the same
    // runtime feel without wiring DataTable. `cozy` is the canonical default
    // for bare tables (cells: py-2, head: h-10); the other two are escape
    // hatches for high-density admin lists and roomy patient-facing views.
    const props = defineProps<{
      class?: HTMLAttributes['class']
      // Extra classes for the scroll container div (e.g. `min-h-0 flex-1` inside a
      // flex column). A sticky TableHeader pins to THIS div -- an outer overflow
      // wrapper around <Table> breaks stickiness, so size the scroller here.
      containerClass?: HTMLAttributes['class']
      density?: 'compact' | 'cozy' | 'comfortable'
    }>()
    
    const densityClass = computed(() => {
      if (props.density === 'compact') return '[&_td]:py-1.5 [&_td]:text-xs [&_th]:h-8 [&_th]:text-xs'
      if (props.density === 'comfortable') return '[&_td]:py-3 [&_th]:h-12'
      // cozy is the new TableCell/TableHead baseline (py-2 / h-10) -- no override.
      return ''
    })
    </script>
    
    <template>
      <div data-uipkge data-slot="table-container" :class="cn('relative w-full overflow-auto', props.containerClass)">
        <table data-uipkge data-slot="table" :class="cn('w-full caption-bottom text-sm', densityClass, props.class)">
          <slot />
        </table>
      </div>
    </template>
    
  • app/components/ui/table/TableBody.vue0.3 kB
  • app/components/ui/table/TableCaption.vue0.3 kB
  • app/components/ui/table/TableCell.vue0.4 kB
  • app/components/ui/table/TableEmpty.vue0.7 kB
  • app/components/ui/table/TableFooter.vue0.4 kB
  • app/components/ui/table/TableHead.vue0.5 kB
  • app/components/ui/table/TableHeader.vue0.3 kB
  • app/components/ui/table/TableRow.vue0.4 kB
  • app/components/ui/table/index.ts0.5 kB
  • app/components/ui/table/utils.ts0.3 kB

Raw manifest:https://uipkge.dev/r/vue/table.json