---
title: Tabelas
description: Organize dados em linhas e colunas. Oferece suporte a tabelas Markdown e componentes Table com ordenação, realce e mesclagem.
---

> **For AI agents:** the complete documentation index is at [llms.txt](/docs/llms.txt). Append `.md` to any page URL for its markdown version.

As tabelas organizam dados em linhas e colunas. O Jamdesk oferece duas abordagens: **tabelas Markdown** para tabelas rápidas e simples e **componentes Table** para recursos avançados, como realce e alinhamento.

## Uso

```mdx
<Table>
  <Row header>
    <Cell>Name</Cell>
    <Cell>Type</Cell>
  </Row>
  <Row>
    <Cell>id</Cell>
    <Cell>string</Cell>
  </Row>
</Table>
```

## Tabelas Markdown

A maneira mais rápida de criar uma tabela. Use barras verticais (`|`) para separar colunas e hífens (`-`) para a linha de cabeçalho:

```markdown
| Name | Type | Description |
|------|------|-------------|
| id | string | Unique identifier |
| email | string | User email address |
```

| Nome | Tipo | Descrição |
|------|------|-------------|
| id | string | Identificador exclusivo |
| email | string | Endereço de e-mail do usuário |

<Tip>
As tabelas Markdown são ideais para dados de referência simples. O componente Table oferece mais controle quando você precisa de realce, alinhamento ou destaque visual.
</Tip>

## Componente Table

Para ter mais controle, use os componentes `<Table>`, `<Row>` e `<Cell>`:

```mdx
<Table>
  <Row header>
    <Cell>Name</Cell>
    <Cell>Type</Cell>
    <Cell>Description</Cell>
  </Row>
  <Row>
    <Cell>id</Cell>
    <Cell>string</Cell>
    <Cell>Unique identifier</Cell>
  </Row>
  <Row>
    <Cell>email</Cell>
    <Cell>string</Cell>
    <Cell>User email address</Cell>
  </Row>
</Table>
```

<Table>
  <Row header>
    <Cell>Nome</Cell>
    <Cell>Tipo</Cell>
    <Cell>Descrição</Cell>
  </Row>
  <Row>
    <Cell>id</Cell>
    <Cell>string</Cell>
    <Cell>Identificador exclusivo</Cell>
  </Row>
  <Row>
    <Cell>email</Cell>
    <Cell>string</Cell>
    <Cell>Endereço de e-mail do usuário</Cell>
  </Row>
</Table>

## Linhas listradas

Adicione fundos alternados às linhas para melhorar a legibilidade:

```mdx
<Table striped>
  <Row header>
    <Cell>Parameter</Cell>
    <Cell>Value</Cell>
  </Row>
  <Row><Cell>timeout</Cell><Cell>30s</Cell></Row>
  <Row><Cell>retries</Cell><Cell>3</Cell></Row>
  <Row><Cell>backoff</Cell><Cell>exponential</Cell></Row>
  <Row><Cell>maxDelay</Cell><Cell>60s</Cell></Row>
</Table>
```

<Table striped>
  <Row header>
    <Cell>Parâmetro</Cell>
    <Cell>Valor</Cell>
  </Row>
  <Row><Cell>timeout</Cell><Cell>30s</Cell></Row>
  <Row><Cell>retries</Cell><Cell>3</Cell></Row>
  <Row><Cell>backoff</Cell><Cell>exponencial</Cell></Row>
  <Row><Cell>maxDelay</Cell><Cell>60s</Cell></Row>
</Table>

## Com bordas e compacto

Adicione bordas entre as células e reduza o espaçamento interno:

```mdx
<Table bordered compact>
  <Row header>
    <Cell>A</Cell>
    <Cell>B</Cell>
    <Cell>C</Cell>
  </Row>
  <Row>
    <Cell>1</Cell>
    <Cell>2</Cell>
    <Cell>3</Cell>
  </Row>
</Table>
```

<Table bordered compact>
  <Row header>
    <Cell>A</Cell>
    <Cell>B</Cell>
    <Cell>C</Cell>
  </Row>
  <Row>
    <Cell>1</Cell>
    <Cell>2</Cell>
    <Cell>3</Cell>
  </Row>
</Table>

## Realce de linhas

Realce linhas inteiras para chamar a atenção:

```mdx
<Table>
  <Row header>
    <Cell>Field</Cell>
    <Cell>Required</Cell>
    <Cell>Description</Cell>
  </Row>
  <Row highlight highlightColor="warning">
    <Cell>api_key</Cell>
    <Cell>Yes</Cell>
    <Cell>Your API authentication key</Cell>
  </Row>
  <Row>
    <Cell>limit</Cell>
    <Cell>No</Cell>
    <Cell>Maximum results (default: 100)</Cell>
  </Row>
</Table>
```

<Table>
  <Row header>
    <Cell>Campo</Cell>
    <Cell>Obrigatório</Cell>
    <Cell>Descrição</Cell>
  </Row>
  <Row highlight highlightColor="warning">
    <Cell>api_key</Cell>
    <Cell>Sim</Cell>
    <Cell>Sua chave de autenticação da API</Cell>
  </Row>
  <Row>
    <Cell>limit</Cell>
    <Cell>Não</Cell>
    <Cell>Máximo de resultados (padrão: 100)</Cell>
  </Row>
</Table>

Cores de realce disponíveis: `primary`, `success`, `warning`, `error`, `info`

## Realce de células

Realce células individuais para indicar status:

```mdx
<Table>
  <Row header>
    <Cell>Service</Cell>
    <Cell>Status</Cell>
  </Row>
  <Row>
    <Cell>API</Cell>
    <Cell highlight highlightColor="success">Operational</Cell>
  </Row>
  <Row>
    <Cell>Database</Cell>
    <Cell highlight highlightColor="warning">Degraded</Cell>
  </Row>
  <Row>
    <Cell>Storage</Cell>
    <Cell highlight highlightColor="error">Outage</Cell>
  </Row>
</Table>
```

<Table>
  <Row header>
    <Cell>Serviço</Cell>
    <Cell>Status</Cell>
  </Row>
  <Row>
    <Cell>API</Cell>
    <Cell highlight highlightColor="success">Operacional</Cell>
  </Row>
  <Row>
    <Cell>Banco de dados</Cell>
    <Cell highlight highlightColor="warning">Degradado</Cell>
  </Row>
  <Row>
    <Cell>Armazenamento</Cell>
    <Cell highlight highlightColor="error">Indisponível</Cell>
  </Row>
</Table>

## Alinhamento de células

Controle o alinhamento do texto por célula:

```mdx
<Table>
  <Row header>
    <Cell align="left">Left</Cell>
    <Cell align="center">Center</Cell>
    <Cell align="right">Right</Cell>
  </Row>
  <Row>
    <Cell align="left">Text</Cell>
    <Cell align="center">Text</Cell>
    <Cell align="right">$99.99</Cell>
  </Row>
</Table>
```

<Table>
  <Row header>
    <Cell align="left">Esquerda</Cell>
    <Cell align="center">Centro</Cell>
    <Cell align="right">Direita</Cell>
  </Row>
  <Row>
    <Cell align="left">Texto</Cell>
    <Cell align="center">Texto</Cell>
    <Cell align="right">$99.99</Cell>
  </Row>
</Table>

## Mesclagem de colunas e linhas

Mescle células entre colunas ou linhas:

```mdx
<Table bordered>
  <Row header>
    <Cell>Category</Cell>
    <Cell>Item</Cell>
    <Cell>Price</Cell>
  </Row>
  <Row>
    <Cell rowSpan={2}>Fruits</Cell>
    <Cell>Apple</Cell>
    <Cell>$1.00</Cell>
  </Row>
  <Row>
    <Cell>Banana</Cell>
    <Cell>$0.50</Cell>
  </Row>
  <Row>
    <Cell colSpan={2}>Subtotal</Cell>
    <Cell>$1.50</Cell>
  </Row>
</Table>
```

<Table bordered>
  <Row header>
    <Cell>Categoria</Cell>
    <Cell>Item</Cell>
    <Cell>Preço</Cell>
  </Row>
  <Row>
    <Cell rowSpan={2}>Frutas</Cell>
    <Cell>Maçã</Cell>
    <Cell>$1.00</Cell>
  </Row>
  <Row>
    <Cell>Banana</Cell>
    <Cell>$0.50</Cell>
  </Row>
  <Row>
    <Cell colSpan={2}>Subtotal</Cell>
    <Cell>$1.50</Cell>
  </Row>
</Table>

## Legenda visível

Mostre uma legenda acessível acima da tabela:

```mdx
<Table caption="Monthly Revenue by Region" captionVisible>
  <Row header>
    <Cell>Region</Cell>
    <Cell align="right">Revenue</Cell>
  </Row>
  <Row>
    <Cell>North America</Cell>
    <Cell align="right">$1.2M</Cell>
  </Row>
</Table>
```

<Table caption="Receita mensal por região" captionVisible>
  <Row header>
    <Cell>Região</Cell>
    <Cell align="right">Receita</Cell>
  </Row>
  <Row>
    <Cell>América do Norte</Cell>
    <Cell align="right">$1.2M</Cell>
  </Row>
</Table>

## Colunas classificáveis

Ative a ordenação interativa de colunas com a prop `sortable`. Os usuários podem clicar nos cabeçalhos das colunas para classificá-las:

```mdx
<Table sortable>
  <Row header>
    <Cell>Name</Cell>
    <Cell>Price</Cell>
    <Cell>Stock</Cell>
  </Row>
  <Row><Cell>Widget A</Cell><Cell>$29.99</Cell><Cell>150</Cell></Row>
  <Row><Cell>Gadget B</Cell><Cell>$49.99</Cell><Cell>75</Cell></Row>
  <Row><Cell>Tool C</Cell><Cell>$19.99</Cell><Cell>200</Cell></Row>
  <Row><Cell>Device D</Cell><Cell>$99.99</Cell><Cell>25</Cell></Row>
</Table>
```

<Table sortable>
  <Row header>
    <Cell>Nome</Cell>
    <Cell>Preço</Cell>
    <Cell>Estoque</Cell>
  </Row>
  <Row><Cell>Widget A</Cell><Cell>$29.99</Cell><Cell>150</Cell></Row>
  <Row><Cell>Gadget B</Cell><Cell>$49.99</Cell><Cell>75</Cell></Row>
  <Row><Cell>Tool C</Cell><Cell>$19.99</Cell><Cell>200</Cell></Row>
  <Row><Cell>Device D</Cell><Cell>$99.99</Cell><Cell>25</Cell></Row>
</Table>

<Tip>
Clique uma vez no cabeçalho de uma coluna para ordenar em ordem crescente, novamente para ordem decrescente e uma terceira vez para redefinir. Os números são ordenados numericamente e o texto, alfabeticamente.
</Tip>

A prop `sortable` funciona com outros recursos, como linhas listradas:

```mdx
<Table sortable striped>
  <Row header>
    <Cell>Team</Cell>
    <Cell>Wins</Cell>
    <Cell>Losses</Cell>
  </Row>
  <Row><Cell>Eagles</Cell><Cell>12</Cell><Cell>4</Cell></Row>
  <Row><Cell>Bears</Cell><Cell>8</Cell><Cell>8</Cell></Row>
  <Row><Cell>Lions</Cell><Cell>10</Cell><Cell>6</Cell></Row>
</Table>
```

<Table sortable striped>
  <Row header>
    <Cell>Equipe</Cell>
    <Cell>Vitórias</Cell>
    <Cell>Derrotas</Cell>
  </Row>
  <Row><Cell>Eagles</Cell><Cell>12</Cell><Cell>4</Cell></Row>
  <Row><Cell>Bears</Cell><Cell>8</Cell><Cell>8</Cell></Row>
  <Row><Cell>Lions</Cell><Cell>10</Cell><Cell>6</Cell></Row>
</Table>

## Props

### Table

| Prop | Tipo | Padrão | Descrição |
|------|------|---------|-------------|
| `striped` | boolean | false | Fundos alternados nas linhas |
| `bordered` | boolean | false | Bordas entre todas as células |
| `compact` | boolean | false | Espaçamento interno reduzido nas células |
| `fullWidth` | boolean | true | A tabela ocupa toda a largura |
| `caption` | string | - | Texto da legenda da tabela |
| `captionVisible` | boolean | false | Mostra a legenda visualmente (padrão: apenas para leitores de tela) |
| `stickyHeader` | boolean | false | Mantém o cabeçalho visível durante a rolagem |
| `sortable` | boolean | false | Ativa a ordenação por clique nos cabeçalhos das colunas |

### Row

| Prop | Tipo | Padrão | Descrição |
|------|------|---------|-------------|
| `header` | boolean | false | Renderiza como linha de cabeçalho |
| `highlight` | boolean | false | Realça a linha |
| `highlightColor` | string | primary | Cor: primary, success, warning, error, info |

### Cell

| Prop | Tipo | Padrão | Descrição |
|------|------|---------|-------------|
| `align` | string | left | Alinhamento do texto: left, center, right |
| `colSpan` | number | - | Número de colunas a abranger |
| `rowSpan` | number | - | Número de linhas a abranger |
| `highlight` | boolean | false | Realça a célula |
| `highlightColor` | string | primary | Cor: primary, success, warning, error, info |
| `header` | boolean | false | Força o estilo de cabeçalho |

## O que vem a seguir?

<Columns cols={2}>
  <Card title="Visão geral dos componentes" icon="puzzle-piece" href="/pt/components/overview">
    Consulte todos os componentes disponíveis
  </Card>
  <Card title="Fundamentos de MDX" icon="file-code" href="/pt/content/mdx-basics">
    Aprenda a usar componentes em MDX
  </Card>
</Columns>