Jamdesk Documentation logo

Tabelas

Organize dados em linhas e colunas. Suporta tabelas markdown e componentes Table com ordenação, destaque e mesclagem de células.

Tabelas organizam dados em linhas e colunas. Use tabelas markdown para tabelas rápidas e simples. Use componentes Table para destaque, alinhamento e outras opções.

Uso

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

Tabelas Markdown

A forma 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 |
NameTypeDescription
idstringUnique identifier
emailstringUser email address

Use tabelas markdown para dados de referência simples. Mude para o componente Table para destaque, alinhamento ou ênfase visual.

Componente Table

Para 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>
NameTypeDescription
idstringUnique identifier
emailstringUser email address

Linhas listradas

Adicione fundos de linha alternados para melhor 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>
ParameterValue
timeout30s
retries3
backoffexponential
maxDelay60s

Com bordas e compacto

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

<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>
ABC
123

Realce de linhas

Destaque 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>
FieldRequiredDescription
api_keyYesYour API authentication key
limitNoMaximum results (default: 100)

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

Realce de células

Destaque células individuais como indicadores de 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>
ServiceStatus
APIOperational
DatabaseDegraded
StorageOutage

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>
LeftCenterRight
TextText$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>
CategoryItemPrice
FruitsApple$1.00
Banana$0.50
Subtotal$1.50

Legenda visível

Exiba 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>
Monthly Revenue by Region
RegionRevenue
North America$1.2M

Colunas classificáveis

Ative a ordenação de colunas com a propriedade sortable. Clique em um cabeçalho de coluna para ordenar:

<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>
NamePriceStock
Widget A$29.99150
Gadget B$49.9975
Tool C$19.99200
Device D$99.9925

Clique em um cabeçalho de coluna uma vez para ordenar em ordem crescente, de novo para decrescente, e uma terceira vez para redefinir. Números são ordenados numericamente, texto em ordem alfabética.

Combine sortable com outras propriedades como striped:

<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>
TeamWinsLosses
Eagles124
Bears88
Lions106

Props

Table

PropTypeDefaultDescription
stripedbooleanfalseFundos de linha alternados
borderedbooleanfalseBordas entre todas as células
compactbooleanfalseEspaçamento de célula reduzido
fullWidthbooleantrueTabela ocupa a largura total
captionstring-Texto da legenda da tabela
captionVisiblebooleanfalseMostra a legenda visualmente (padrão: apenas leitor de tela)
stickyHeaderbooleanfalseMantém o cabeçalho visível ao rolar
sortablebooleanfalseAtiva a ordenação por clique nos cabeçalhos de coluna

Row

PropTypeDefaultDescription
headerbooleanfalseRenderiza como linha de cabeçalho
highlightbooleanfalseDestaca a linha
highlightColorstringprimaryCor: primary, success, warning, error, info

Cell

PropTypeDefaultDescription
alignstringleftAlinhamento do texto: left, center, right
colSpannumber-Colunas a mesclar
rowSpannumber-Linhas a mesclar
highlightbooleanfalseDestaca a célula
highlightColorstringprimaryCor: primary, success, warning, error, info
headerbooleanfalseForça estilo de cabeçalho

O que vem a seguir?

Visão geral dos componentes

Explore todos os componentes disponíveis

Fundamentos de MDX

Aprenda a usar componentes em MDX