Tabelas
Organize dados em linhas e colunas. Oferece suporte a tabelas Markdown e componentes Table com ordenação, realce e mesclagem.
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
<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:
| Name | Type | Description |
|------|------|-------------|
| id | string | Unique identifier |
| email | string | User email address |
| Nome | Tipo | Descrição |
|---|---|---|
| id | string | Identificador exclusivo |
| string | Endereço de e-mail do usuário |
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.
Componente Table
Para ter mais controle, use os componentes <Table>, <Row> e <Cell>:
<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>
| Nome | Tipo | Descrição |
|---|---|---|
| id | string | Identificador exclusivo |
| string | Endereço de e-mail do usuário |
Linhas listradas
Adicione fundos alternados às linhas para melhorar a legibilidade:
<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>
| Parâmetro | Valor |
|---|---|
| timeout | 30s |
| retries | 3 |
| backoff | exponencial |
| maxDelay | 60s |
Com bordas e compacto
Adicione bordas entre as células e reduza o espaçamento interno:
<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>
| A | B | C |
|---|---|---|
| 1 | 2 | 3 |
Realce de linhas
Realce linhas inteiras para chamar a atenção:
<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>
| Campo | Obrigatório | Descrição |
|---|---|---|
| api_key | Sim | Sua chave de autenticação da API |
| limit | Não | Máximo de resultados (padrão: 100) |
Cores de realce disponíveis: primary, success, warning, error, info
Realce de células
Realce células individuais para indicar status:
<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>
| Serviço | Status |
|---|---|
| API | Operacional |
| Banco de dados | Degradado |
| Armazenamento | Indisponível |
Alinhamento de células
Controle o alinhamento do texto por célula:
<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>
| Esquerda | Centro | Direita |
|---|---|---|
| Texto | Texto | $99.99 |
Mesclagem de colunas e linhas
Mescle células entre colunas ou linhas:
<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>
| Categoria | Item | Preço |
|---|---|---|
| Frutas | Maçã | $1.00 |
| Banana | $0.50 | |
| Subtotal | $1.50 | |
Legenda visível
Mostre uma legenda acessível acima da tabela:
<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>
| Região | Receita |
|---|---|
| América do Norte | $1.2M |
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:
<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>
| Nome | Preço | Estoque |
|---|---|---|
| Widget A | $29.99 | 150 |
| Gadget B | $49.99 | 75 |
| Tool C | $19.99 | 200 |
| Device D | $99.99 | 25 |
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.
A prop sortable funciona com outros recursos, como linhas listradas:
<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>
| Equipe | Vitórias | Derrotas |
|---|---|---|
| Eagles | 12 | 4 |
| Bears | 8 | 8 |
| Lions | 10 | 6 |
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 |
