Componente

Table

Uma tabela de dados construída sobre markup nativo com diretivas. Estilize com tamanho, listras, linhas de grade e hover; torne cabeçalhos ordenáveis; selecione linhas única ou múltipla; alterne colunas; e filtre e ordene os dados com os pipes inclusos.

Estrutura e estilo

Autumn photos
IndexTitleCityTaken
IMG·019Oak leavesFreiburg2026·11·03
IMG·020Foggy morningMunich2026·11·08
IMG·021ChestnutsBerlin2026·11·15
import { ChangeDetectionStrategy, Component } from '@angular/core';

import { HbTableImports } from '@herbst/ui';

@Component({
  selector: 'hb-demo-table-basic',
  imports: [HbTableImports],
  template: `
    <hb-table hbStriped hbGridlines hbSize="sm" class="w-full max-w-lg">
      <caption hb-table-caption>
        Autumn photos
      </caption>
      <thead hb-table-header>
        <tr hb-table-row>
          <th hb-table-head>Index</th>
          <th hb-table-head>Title</th>
          <th hb-table-head>City</th>
          <th hb-table-head>Taken</th>
        </tr>
      </thead>
      <tbody hb-table-body>
        @for (r of rows; track r.id) {
          <tr hb-table-row>
            <td hb-table-cell>IMG·{{ r.id }}</td>
            <td hb-table-cell>{{ r.species }}</td>
            <td hb-table-cell>{{ r.family }}</td>
            <td hb-table-cell>{{ r.shelf }}</td>
          </tr>
        }
      </tbody>
    </hb-table>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HbDemoTableBasicComponent {
  protected readonly rows = [
    { id: '019', species: 'Oak leaves', family: 'Freiburg', shelf: '2026·11·03' },
    { id: '020', species: 'Foggy morning', family: 'Munich', shelf: '2026·11·08' },
    { id: '021', species: 'Chestnuts', family: 'Berlin', shelf: '2026·11·15' },
  ];
}

Ordenável e filtrada

TitleCityYear
ChestnutsHamburg2026
Foggy morningMunich2025
Forest pathBerlin2023
Oak leavesFreiburg2024

Seleção de linhas

TitleCity
Oak leavesFreiburg
Foggy morningMunich
Forest pathBerlin
ChestnutsHamburg

0 selected

Referência de API

hb-table — appearance

PropriedadeDescriçãoTipoPadrão
[hbSize] Altura das linhas e escala do texto. 'xs' | 'sm' | 'md' | 'lg' | 'xl' 'md'
[hbStriped] / [hbGridlines] / [hbHoverable] / [hbBordered] Linhas zebradas, bordas de célula, destaque de hover, e uma borda externa. boolean false / false / true / true
[hbScrollable] / [hbScrollHeight] Restringe a altura com cabeçalho fixo e rola o corpo. boolean / string false / —
[hbLoading] Sobrepõe um spinner enquanto os dados carregam. boolean false

hb-table — selection

PropriedadeDescriçãoTipoPadrão
[hbSelectionMode] Se as linhas são selecionáveis, e quantas de uma vez. 'none' | 'single' | 'multiple' 'none'
[(hbSelection)] A(s) linha(s) selecionada(s) — um valor para single, um array para multiple. Bidirecional. unknown null
[hbDataKey] / [hbCompareWith] Uma propriedade que identifica unicamente uma linha, ou uma função de igualdade customizada. string / (a, b) => boolean '' / —
[hbMetaKeySelection] / (hbRowActivate) Exige Ctrl/Cmd para adicionar a uma seleção múltipla, e emite uma linha ao pressionar Enter. boolean / unknown false

hb-table — sorting & columns

PropriedadeDescriçãoTipoPadrão
[hbSortMode] / [(hbSort)] Ordenação de coluna única ou múltipla, e o meta de ordenação bidirecional ({ field, order }). 'single' | 'multiple' / HbSortMeta | HbSortMeta[] 'single' / null
[hbRemovableSort] / [hbCustomSort] Permite limpar a ordenação ao passar do descendente, e pula a reordenação embutida (você ordena os dados). boolean false
[(hbHiddenColumns)] As keys das colunas ocultadas pelo hb-table-column-toggle. string[] []
[hbKeyboardNavigation] / [hbShowShortcuts] Habilita navegação de linhas por setas/Home/End/Espaço/Enter, e mostra uma legenda de atalhos abaixo da tabela. boolean false

Structure & pipes

PropriedadeDescriçãoTipoPadrão
thead / tbody / tfoot / tr / th / td / caption Elementos nativos com diretivas: [hb-table-header], [hb-table-body], [hb-table-footer], [hb-table-row] (com [hbRowValue]), [hb-table-head] (com [hbSortField]), [hb-table-cell], [hb-table-caption]. directives
hb-table-select-all / -checkbox / -radio Controles de seleção prontos: um selecionar-tudo no cabeçalho, e um checkbox ou radio por linha. components
hb-table-expand-toggle / -column-toggle Um expansor por linha (com (hbExpandedChange)), e um menu para mostrar/ocultar colunas. components
hbTableSort / hbTableFilter pipes Ordena linhas pelo meta de sort, e filtra linhas por uma query sobre campos dados — aplicados na expressão @for. pipe