Skip to content
QwryAI
Documentation
Pages

Widgets

Data Display

Components for structured data: Table and Chart

Table

A table built from rows and cells. A Table holds Table.Row elements, and each row holds Table.Cell elements.

jsx
<Table>
  <Table.Row header>
    <Table.Cell>
      <Text value="Item" weight="medium" />
    </Table.Cell>
    <Table.Cell align="end">
      <Text value="Price" weight="medium" />
    </Table.Cell>
  </Table.Row>
  {items.map((item) => (
    <Table.Row key={item.sku}>
      <Table.Cell>
        <Text value={item.name} />
      </Table.Cell>
      <Table.Cell align="end">
        <Text value={item.price} tabularNums />
      </Table.Cell>
    </Table.Row>
  ))}
</Table>

Table itself has no props.

Table.Row Props

PropTypeDefaultDescription
headerbooleanfalseMakes the row a header row of column headings.

Table.Cell Props

PropTypeDefaultDescription
widthnumber | string—Cell width.
colSizexs | sm | md | lg | xl—Preset width: 64, 96, 144, 192 or 240 px. width wins when both are set.
colSpannumber1How many columns the cell covers.
rowSpannumber1How many rows the cell covers.
paddingnumber | string—Cell padding.
alignstart | center | endstartHorizontal alignment of the content.
vAlignstart | center | endcenterVertical alignment of the content.

Chart

Bar, line, area and pie charts. A chart can combine several series, such as bars for sales with a line for the target.

jsx
<Chart
  data={weeklyOrders}
  xAxis="week"
  series={[
    { type: "bar", dataKey: "orders", label: "Orders", color: "blue" },
    { type: "line", dataKey: "returns", label: "Returns", color: "orange" }
  ]}
  height={220}
/>

Props

PropTypeDefaultDescription
dataobject[]—The data points, one object per point.
seriesobject[]—What to draw. See Series options.
xAxisstring | {dataKey, labels?, hide?}—The key for the x-axis. As an object, labels maps raw values to display names and hide hides the axis.
yAxis{domain}automaticY-axis range: [min, max] or {min, max}, where each end is a number or "auto".
showYAxisbooleanfalseShows y-axis labels.
showLegendbooleantrueShows the legend when a series has a label.
showTooltipbooleantrueShows values on hover.
tooltipValueFormatterobject—Formats tooltip numbers: style (decimal, currency, percent, unit), currency, unit, notation, minimumFractionDigits, maximumFractionDigits, locale.
showGridbooleantrueShows grid lines.
showDotsbooleanfalseMarks every point on line and area series.
showHoverDotsbooleantrueMarks the hovered point.
showValueLabelsbooleanfalseWrites each value on the chart.
valueLabelIntervalnumber1With value labels, labels every Nth point.
valueLabelOffsetnumber0With value labels, the point to start from.
barRadiusnumber4Corner rounding of bars.
barGapnumber—Space between bars in the same group.
barCategoryGapnumber | string—Space between groups of bars.
scrollablebooleanfalseLets a long chart scroll sideways.
visiblePointCountnumber—With scrollable, how many points fit in view.
minPointWidthnumber48With scrollable, the least width of each point in pixels.
scrollToValuestring | number—With scrollable, the x-axis value to scroll to at the start.
disableUserScrollbooleanfalseWith scrollable, stops the visitor scrolling the chart.
widthnumber | string100%Chart width.
heightnumber | string4:3 aspect ratioChart height.
ariaLabelstringWidget chartName read by screen readers.

Chart also accepts the size props size, minWidth, maxWidth, minHeight, maxHeight, minSize, maxSize, aspectRatio and flex.

Series Options

PropTypeDescription
typebar | line | area | pieHow to draw the series.
dataKeystringThe key in each data object that holds this series' values.
labelstringName in the legend and tooltip.
colorcolorSeries color, such as blue, green-500 or a CSS color. Series without one take colors in turn from blue, purple, orange, green, red, yellow and pink.
fillColorcolorFill of an area series, when it should differ from color.
stackstringSeries with the same stack name are stacked on each other.
curveTypenatural | linear | monotone | step | stepBefore | stepAfter | basis | bump and othersLine shape for line and area series. Defaults to natural.

Next steps

Explore the documentation