Card styling reference
On this page
A card is one tile on a POS screen, such as a product with an image, name, and price, an action tile, or a fulfillment station. Use this reference to restyle cards with CSS: change the fill, corners, shadow, and image of every card, or of product cards only.
Cards shrink to fit the space they’re given. A smaller card shows less information, and the smallest cards show faint placeholder bars in place of text. Follow the POS styling API rules when you style a card.
Where cards appear
Cards appear wherever a POS screen lays out records as tiles, such as the products in a products
grid and the tiles of an action grid. Products show as product cards, named product-card,
wherever they appear: in a products grid, as product tiles in an action grid, and as the
components of a bundle. Actions, stations, and other records show as other kinds of card.
Every card has the card-root and card-surface parts. A card that shows an image also has
card-image, and a card that shows text under the image has card-body.
How cards display
Inside a layout, the layout sets the size of each card to fit
the cell. To change the number of columns in a grid, set --sc-layout-item-min-width on
layout-root. Setting --sc-card-min-width on layout-root also widens the columns, but when
both are set, the POS uses --sc-layout-item-min-width.
An action tile can have a color, set in the Color field (s_c__Color__c) of the POS action
item. That color shows in place of --sc-card-bg-color, so action tiles keep their configured
colors when you change the fill of every card. A background-color rule on card-surface is
different: it replaces the configured colors too. To change the fill of product cards and leave
action tiles as they are, add product-card to the selector, as the tint example under
Card styling examples shows.
Parts of a card
| Part | What it is | Available from |
|---|---|---|
card-root |
The whole card: the box a layout sizes, around the surface. The size properties take effect here. | v22.0.10 |
card-surface |
The visible card: the fill, border, corners, and shadow, with the image and text inside. | v22.0.10 |
card-image |
The image at the top of a card, when the card has one. | v22.0.10 |
card-body |
The text under the image on a product card or an action tile, or on a card that shows a name and details. | v22.0.10 |
The Available from column shows the first release that carries the name.
Card attributes
The data-status attribute on card-surface marks two kinds of card that look different from
the rest:
temporary— a station card for a fulfillment station whose tickets this register is printing for now, either while that station is unavailable or because the register is set up to print themmissing— a ticket card for a ticket the POS couldn’t find
Temporary cards keep their own fill, and missing cards keep their own fill, text color, and
border, so operators can still tell them apart from other cards after you restyle the cards. To
change them, set background-color, color, or border on card-surface, and narrow the
selector to one status inside :where(), as in
[part~='card-surface']:where([data-status='missing']).
| Attribute | Values | Default | Available from |
|---|---|---|---|
card-surface[data-status] |
normal, temporary, missing |
normal |
v22.0.10 |
Product card name
Product cards carry an extra identifying name, product-card, beside card-root. It’s a label
for your CSS selectors, not a Salesforce API name. Select product-card to style product cards
without changing action tiles, station cards, or other cards. To reach a part inside a product
card, put the name first in the selector, as in [part~='product-card'] [part~='card-surface'].
| Name | What it is | Available from |
|---|---|---|
product-card |
A product’s card, in a product grid, an action grid, or a bundle’s components. | v22.0.10 |
Card component properties
Set these properties on card-root to change every card, on product-card to change only
product cards, or on layout-root to change the cards in a layout. They don’t change every
color of a temporary or missing card: the descriptions below say which colors those cards keep,
and Card attributes shows how to change them.
| Property | What it sets | Default | Available from |
|---|---|---|---|
--sc-card-width |
How wide a card is outside a layout. Inside one, the layout sizes it. | 180px | v22.0.10 |
--sc-card-min-width |
The narrowest a card gets, and the narrowest the columns of a grid layout get unless the layout’s --sc-layout-item-min-width is set. |
none | v22.0.10 |
--sc-card-min-height |
The shortest a card gets. | none | v22.0.10 |
--sc-card-bg-color |
The fill of a normal card, under an action tile’s configured color. Temporary and missing cards keep their own. | none | v22.0.10 |
--sc-card-color |
The text color of a normal or temporary card, under an action tile’s configured color. Missing cards keep their own. | none | v22.0.10 |
--sc-card-border |
The border of a normal or temporary card, as a border shorthand, such as none to remove it. Missing cards keep their own. |
none | v22.0.10 |
--sc-card-shadow |
The shadow under a card, as a box shadow, such as none to remove it. |
none | v22.0.10 |
--sc-card-radius |
The corners of a card, in place of the ones that grow with the card’s width. | none | v22.0.10 |
--sc-card-hover-bg-color |
The wash over a card while it is hovered, under an action tile’s configured one. It shows at 40% opacity. | none | v22.0.10 |
--sc-card-headline-weight |
The weight of the large title on an action or station card. | none | v22.0.10 |
--sc-card-image-aspect-ratio |
The shape of a card’s image, as width / height. | 1.3 / 1 | v22.0.10 |
--sc-card-image-object-fit |
How the image fills the frame, such as cover to crop it or contain to show all of it, in place of the screen’s. |
none | v22.0.10 |
--sc-card-image-size |
The width and height of the image’s box inside the frame, in place of the screen’s. | none | v22.0.10 |
--sc-card-image-vignette |
The soft shadow inside the image’s edges, as a box shadow, such as none to remove it. |
none | v22.0.10 |
Card styling examples
StoreConnect’s automated tests run each of these examples against the POS whenever the POS code changes, so they work as written.
“Give the cards a white fill, squarer corners, and no shadow.”
```css
[part~=’card-root’] { –sc-card-bg-color: #ffffff; –sc-card-radius: 6px; –sc-card-shadow: none; } ```
“Tint the product cards, and leave the action tiles as they are.” Name the product cards first:
```css
part~=’product-card’ { background-color: #e8f0fb; } ```
“Make a ticket that wasn’t found stand out more.” Narrow the surface to the missing status:
```css
background-color: #fdecea; } ```
“Make the product images square, and show all of each image.”
```css
[part~=’product-card’] { –sc-card-image-aspect-ratio: 1; –sc-card-image-object-fit: contain; } ```
“Remove the shadow inside the images’ edges.”
```css
[part~=’card-root’] { –sc-card-image-vignette: none; } ```
“Make the columns of a grid wider.”
```css
–sc-card-min-width: 260px; } ```
What can’t be styled on a card yet
- The text on a card, such as a product’s name and code, on its own
- The tag, the quantity buttons, and the variant menu on a product card
- The header and preview on a station card
- The body of a card that shows custom content, such as an action with a custom view
- How the smallest cards hide or redact the text
- The shape of a product card’s image when it shows several, as some of a bundle’s components do
- The layout of a card, such as a list card with the image beside the text
Retired card names
None yet.
Was this article helpful?
Thanks for your feedback! It helps us improve our docs.