Skip to content

Components: Shared

Generic pieces used across pages: empty states, form fields, section tabs and skeletons.

Generated from apps/theme/src/components/shared/: 5 files, 6 components. Import a component through the @/components/… path shown, so a fork can override it in src/custom/.

@/components/shared/blog-post-card-skeleton

apps/theme/src/components/shared/blog-post-card-skeleton.tsx server component

<BlogPostCardSkeleton>

Loading placeholder for a large <BlogPostCard>, shared by the blog index and blog-tag route shells.

It reproduces the card's BOX, not a flat rectangle: rounded-sm bg-surface wrapping an aspect-[16/9] image over a p-8 body (meta row → title → excerpt). A flat block of the wrong height moves the whole grid — and every band below it — the moment posts arrive. Keep in step with components/commerce/blog-post-card.tsx.

No props.

@/components/shared/empty-state

apps/theme/src/components/shared/empty-state.tsx server component

<EmptyState>

The standard centered empty state (icon, title, optional description and action) on the bordered bg-surface panel, composing ui/empty. Used by the account tabs, drawers, and anywhere a list has nothing to show.

PropTypeDescription
iconLucideIcon
titleReactNode
description?ReactNode
action?ReactNode
className?string
iconClassName?string

@/components/shared/form-field

apps/theme/src/components/shared/form-field.tsx server component

<FormField>

The standard stacked form field: Label over control with the theme's 6px rhythm (gap-1.5, equivalent to the legacy mb-1.5 block / space-y-1.5 label patterns). For checkbox/radio rows (label wrapping the control) use <Label> directly.

The label content is wrapped in a single inline <span> so a trailing required asterisk (or an inline "(optional)" suffix passed via label) flows inline — the canonical ui/label Label is flex items-center gap-2, which would otherwise space multiple direct children apart.

PropTypeDescription
labelReactNode
htmlFor?string
hint?ReactNode
error?ReactNode
required?boolean
className?string
labelClassName?string
childrenReactNode

@/components/shared/product-card-skeleton

apps/theme/src/components/shared/product-card-skeleton.tsx server component

<ProductCardSkeleton>

The single product-card loading placeholder, shared by the listing pages, recommendation grids, route loading.tsx files and drawers.

It deliberately mirrors the Apple-Store-style ProductCard box EXACTLY, because any height difference becomes a layout shift the moment products arrive:

  panel (`rounded-sm`, `bg-surface`, `p-4 sm:p-5`, `h-full`) → image (aspect-square)
  → `mt-4 flex flex-col gap-1.5` → 2-line name → rating row (h-4)
  → price block (`min-h-[5.125rem] xl:min-h-[4.125rem]`)

The lh units are what make it exact rather than approximate: the name wrapper carries the same text-lg sm:text-xl leading-snug as the card's name link, so min-h-[2lh] is precisely the two line boxes that link reserves. The price bar sits in a text-xl box — matching ProductPrice size="lg" — so h-[1lh] is exactly one price line box, and its wrapper reserves the same EU Omnibus space the card does.

Bars use bg-surface-muted: the stock bg-muted is the same colour as the panel's --surface and would be invisible on it.

The star-rating row IS reserved: the card always holds its space (uniform card height), so the skeleton must too.

No props.

<ProductGridSkeleton>

A grid of ProductCardSkeletons.

Geometry comes from the shared PRODUCT_GRID_COL_CLASSES / PRODUCT_GRID_GAP that ProductGrid and CategoryProductGrid use, so the skeleton and the real grid can never disagree on column count or gutter. Pass columns to match the grid you are standing in for — do NOT hand-write a different grid string in className (a mismatched grid-cols-/gap- here was a measured mobile CLS source). className remains available for non-geometry tweaks.

gridClassName is the escape hatch for a grid that isn't one of the shared listing shapes: it REPLACES the default columns+gap instead of merging with them, so there is no reliance on tailwind-merge conflict resolution. It has no caller today — the deals / best-sellers pages used to run a denser 5-column strip through it, and now use the shared listing geometry like every other product grid. Prefer columns.

PropTypeDescription
count?number
columns?ProductGridColumns
gridClassName?string

Also accepts: React.ComponentProps<"div">

@/components/shared/section-tabs

apps/theme/src/components/shared/section-tabs.tsx client component

<SectionTabs>

The homepage section tab strip: a wrapping row of Buttons where the active tab is default and the rest are secondary. Deliberately NOT Radix Tabs — these strips drive lazy fetches (and elsewhere route links), not content-switching panels.

PropTypeDescription
tabsSectionTabItem[]
activeIndexnumber
onSelect(index: number) => void
className?string