Skip to content
QwryAI
Documentation
Pages

Widgets

Layout

Layout components that arrange a Widget's content: Card, Basic, Box, Col, Row, Form, Grid, Spacer, Divider, ListView, ListViewItem, CardCarousel and Stack

Layout components hold and arrange everything else in a Widget. A Widget's outermost element must be one of Card, Basic, CardCarousel, ListView, Box, Col or Row; most Widgets start with a Card.

Common Layout Props

Box, Col, Row, Basic, Form and ListViewItem share these props.

PropTypeDescription
paddingnumber | string | {top, right, bottom, left, x, y}Inner spacing. An object sets sides separately; x and y set both sides of an axis.
marginnumber | string | {top, right, bottom, left, x, y}Outer spacing, in the same format as padding.
bordernumber | {size, color?, style?}Border. A number is its width in pixels. An object can also set one side with top, right, bottom, left, x or y.
radiusnone | 2xs | xs | sm | md | lg | xl | 2xl | 3xl | 4xl | full | numberCorner rounding, from 2 px (2xs) to 24 px (4xl).
backgroundcolorBackground color.
widthnumber | stringWidth.
heightnumber | stringHeight.
sizenumber | stringSets width and height together.
minWidthnumber | stringMinimum width.
maxWidthnumber | stringMaximum width.
minHeightnumber | stringMinimum height.
maxHeightnumber | stringMaximum height.
minSizenumber | stringSets minWidth and minHeight together.
maxSizenumber | stringSets maxWidth and maxHeight together.
aspectRationumber | stringFixed aspect ratio, such as 16/9.
gapnumber | stringSpace between children.
alignstart | center | end | baseline | stretchCross-axis alignment.
justifystart | center | end | between | around | evenly | stretchMain-axis distribution.
flexnumber | stringFlex grow and shrink.
wrapnowrap | wrap | wrap-reverseWhether children wrap onto new lines.

Colors accept a theme token (primary, secondary, tertiary, success, caution, warning, danger, info, discovery, surface, surface-secondary, surface-tertiary, surface-elevated, subtle, white, black), a palette shade such as blue-500 or gray-100, alpha-40 for a see-through version of the current text color, any CSS color, or { light, dark } for a different color in each theme.

Card

The usual root container. A Card draws a bordered, rounded panel and can add confirm and cancel buttons under it.

jsx
<Card size="md" status={{ text: "Order #10482", icon: "package" }}>
  <Title value={title} size="sm" />
  <Text value={description} color="secondary" />
</Card>

Props

PropTypeDefaultDescription
sizesm | md | lg | fullsmCard width: 360 px, 440 px, 560 px or the full width of the chat.
paddingnumber | string | object4Inner spacing.
backgroundcolorcard colorBackground color.
bordernumber | object1 px borderBorder, as in the common props.
status{text, icon?} or {text, favicon?, frame?}—A small header line above the card, with an icon or a site icon.
confirm{label, action}—Adds a primary button under the card. label defaults to Confirm.
cancel{label, action}—Adds an outline button under the card. label defaults to Cancel.
asFormbooleanfalseMakes the card a form: the confirm button submits every field inside it.
collapsedbooleanfalseOn the outermost card, starts with the body hidden behind the status line and a Show details control.
themelight | darkthe chat's themeForces a color theme for the card and everything in it.

Basic

A plain container with no card styling. Use it as a root when you want the Widget to sit directly in the chat, or to force a theme on part of a Widget.

jsx
<Basic gap={2} theme="dark" padding={4} background="gray-900" radius="xl">
  <Text value="Members get free returns" />
</Basic>

Props

Basic accepts all common layout props plus:

PropTypeDefaultDescription
directionrow | colcolDirection of its children.
themelight | darkthe chat's themeForces a color theme inside the container.

Box

A flex container for arranging children in either direction.

jsx
<Box direction="row" align="center" gap={3} padding={4}>
  <Icon name="star" />
  <Text value="Featured" />
</Box>

Props

Box accepts all common layout props plus:

PropTypeDefaultDescription
directionrow | colcolFlex direction.
flushbooleanfalseStretches to the edges of the parent, ignoring its padding.
scrollablebooleanfalseScrolls when the content overflows.

Col

A vertical container: a Box that always stacks its children top to bottom.

jsx
<Col gap={2}>
  <Title value={title} size="sm" />
  <Text value={subtitle} color="secondary" />
</Col>

Props

Col accepts all common layout props.

Row

A horizontal container: a Box that always places its children side by side. Children are centered vertically unless you set align.

jsx
<Row gap={3}>
  <Image src={avatar} size={40} radius="full" />
  <Text value={name} weight="semibold" />
  <Spacer />
  <Button label="View" variant="outline" />
</Row>

Props

Row accepts all common layout props.

Form

A container that collects the fields inside it and runs one function on submit. See Form Inputs.

Form accepts all common layout props plus direction and onSubmitAction.

Grid

A grid with a set number of columns. Each child is a Grid.Item.

jsx
<Grid columns={2} gap={2}>
  <Grid.Item>
    <Text value="Subtotal" />
  </Grid.Item>
  <Grid.Item>
    <Text value={subtotal} textAlign="end" />
  </Grid.Item>
</Grid>

Grid Props

PropTypeDefaultDescription
columnsnumber | stringequal columns that fitA number of equal columns, or a CSS grid-template-columns value.
gapnumber | string2Space between cells.

Grid.Item Props

PropTypeDefaultDescription
spannumber1How many columns the item covers.

Spacer

Flexible empty space that grows to fill the room along the parent's main axis.

jsx
<Row>
  <Text value="Left" />
  <Spacer />
  <Text value="Right" />
</Row>

Props

PropTypeDefaultDescription
minSizenumber | string—The smallest the spacer can shrink to.

Divider

A horizontal line between sections.

jsx
<Col>
  <Text value="Items" />
  <Divider flush />
  <Text value="Total" />
</Col>

Props

PropTypeDefaultDescription
spacingnumber | stringautomaticSpace above and below the line.
colorcolorborder colorLine color.
sizenumber | string1Line thickness.
flushbooleanfalseStretches the line to the edges of the parent, ignoring its padding.

ListView

A list of items, each a ListViewItem. When there are more items than limit, the list adds a Show N more button that expands it, and Show less to collapse it again.

jsx
<ListView limit={3} status={{ text: "Recent orders", icon: "shopping-bag" }}>
  {orders.map((order) => (
    <ListViewItem key={order.number} gap={3}>
      <Text value={order.number} weight="medium" />
      <Spacer />
      <Badge label={order.status} color="info" />
    </ListViewItem>
  ))}
</ListView>

Props

PropTypeDefaultDescription
limitnumber | "auto"4How many items show before Show N more. "auto" shows them all.
orientationhorizontal | verticalverticalLay the items out in a column or a scrolling row.
gapnumber | stringautomaticSpace between items.
status{text, icon?} or {text, favicon?, frame?}—A header line above the list.
themelight | darkthe chat's themeForces a color theme for the list.

A ListView can contain ListViewItem elements, and state blocks around them.

ListViewItem

One row of a ListView. It lays its children out in a row, centered vertically, with a padding of 2.5 (10 px). Give it an onClickAction to make the whole row clickable.

jsx
<ListViewItem onClickAction={{ functionName: "openOrder", additionalInputs: { number: order.number } }} gap={3}>
  <Image src={order.thumbnail} size={40} />
  <Text value={order.number} />
</ListViewItem>

Props

ListViewItem accepts all common layout props plus:

PropTypeDefaultDescription
onClickActionaction—Function to run when the row is clicked. Makes the row a button with hover and keyboard focus.

CardCarousel

A horizontally scrolling row of link cards, each a CardLinkItem. Use it for articles, products or locations a visitor can open.

jsx
<CardCarousel status={{ text: "Help articles", icon: "book-open" }}>
  {articles.map((article) => (
    <CardLinkItem key={article.url} href={article.url} hrefLabel={article.title}>
      <Title value={article.title} size="sm" />
      <Caption value={article.summary} maxLines={2} />
    </CardLinkItem>
  ))}
</CardCarousel>

CardCarousel Props

PropTypeDefaultDescription
gapnumber | string4Space between cards.
status{text, icon?} or {text, favicon?, frame?}—A header line above the carousel.
themelight | darkthe chat's themeForces a color theme for the carousel.

CardLinkItem Props

PropTypeDefaultDescription
hrefstring—The page the card opens in a new tab. Only https:, mailto: and tel: links work.
hrefLabelstringGo to articleAccessible name of the link, read by screen readers.
paddingnumber | string | object4Inner spacing.
backgroundcolor—Background color.

Stack

An invisible wrapper that holds a state: a group of elements shown or hidden together. A Stack draws nothing of its own; its children appear in place of it. Inside a ListView, a Stack can wrap ListViewItem rows.

jsx
<Stack widgetStateName="Delivered" visible={{ "$state": "/status", "eq": "Delivered" }}>
  <Text value="Your order has arrived." />
</Stack>

Props

PropTypeDefaultDescription
widgetStateNamestring—The state's name in the States tab.
visibleboolean | conditiontrueWhen the group shows. The States tab writes this for you.

Next steps

Explore the documentation