Documentation
Feedback
Guides
Storefront Development

Storefront Development
Storefront development
Table

Displays information in a friendly way, allowing users to scan for details quickly.

Tables display information in a friendly way, allowing users to scan for details quickly.The Table component is a compound of the following:
  • Table - renders a <div> as wrapper with a <table> tag inside it.
  • TableBody - renders a <tbody> tag.
  • TableHead - renders a <thead> tag.
  • TableRow - renders a <tr> tag.
  • TableFooter - renders a <tfoot> tag.
  • TableCell - renders a <th> or <td> tag depending on the value of the variant prop.
Example
Code
Colored + Icon
Values
Width1.5m
Height1.5m
Dimensions7 x 3 x 9 in
Bordered + Icon
Total
1x$200
2x$200
3x$204
ColoredTotal
1x$200
2x$200
3x$204
BorderedTotal
1x$200
2x$200
3x$204

Usage

Import the component


_10
import { Table } from "@faststore/ui";

Import styles

To apply styles, include the following in your stylesheet:

_10
@import "@faststore/ui/src/components/molecules/Table/styles.scss";


Examples

Colored

Example
Code
ColoredTotal
1x$200
2x$200
3x$204
Example
Code
1x$200
2x$200
3x$204
Total$604

Bordered

Example
Code
BorderedTotal
1x$200
2x$200
3x$204

Horizontal Scroll

Example
Code
Installments
Monthly Payment
Min Items
Max Items
Subtotal
Total
1x$20014$200$200
2x$1001020$100$200
3x$68110$68$204

Design tokens

Nested Elements

Head

Local tokenDefault value/Global token linked
--fs-table-head-weightvar(--fs-text-weight-bold)
--fs-table-head-bkg-colornone
--fs-table-head-padding-yvar(--fs-spacing-2)

Cell

Local tokenDefault value/Global token linked
--fs-table-cell-padding-xvar(--fs-spacing-3)
--fs-table-cell-padding-yvar(--fs-spacing-1)
Local tokenDefault value/Global token linked
--fs-table-footer-weightvar(--fs-table-head-weight)
--fs-table-footer-bkg-colornone

Design tokens: Colored

Local tokenDefault value/Global token linked
--fs-table-colored-bkg-color
var(--fs-color-neutral-1)
--fs-table-colored-border-radiusvar(--fs-border-radius)

Design tokens: Bordered

Local tokenDefault value/Global token linked
--fs-table-bordered-border-widthvar(--fs-border-width)
- --fs-table-bordered-border-color
var(--fs-border-color-light)

Data attributes

You can target and override Table styles using the following data attributes:
data-fs-table
data-fs-table-content
data-fs-table-head
data-fs-table-row
data-fs-table-footer
data-fs-table-body
data-fs-table-cell="head | data"
data-fs-table-variant="colored | bordered"

Props

All table-related components support all attributes also supported by their respective HTML tags. Besides those attributes, the following props are also supported:

Table

NameTypeDescriptionDefault
variant"colored" | "bordered"Defines what style this component should use.colored
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-table
onResizeReactEventHandler<unknown>Call a function when the component is resized.
onResizeCaptureReactEventHandler<unknown>A version of onResize that fires in the capture phase.
noncestringA randomly generated string that is only used once.

TableBody

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-table-body

TableHead

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-table-head

TableRow

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-table-row

TableFooter

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-table-footer

TableCell

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-table-cell
variant"data" | "header"Specify if this component should be rendered as a header (`<th>`) or as a data cell (`<td>`).data
scope"col" | "row" | "rowgroup" | "colgroup"Defines the cells that the header element (`<th>`) relates to. @see scope https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
align"left" | "center" | "right"Defines how this component should be aligned.
Contributors
3
Photo of the contributor
Photo of the contributor
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
3
Photo of the contributor
Photo of the contributor
Photo of the contributor
On this page