X Enterprises
Composables

useXCards

Returns the deep-merged design token configuration for all XCard components — colors, fonts, radius, spacing, defaults, and brand.

useXCards

Reads appConfig.x.cards and deep-merges it over built-in defaults using defu. Returns the full XCardsConfig object consumed by every XCard* component. Use it in your own components or pages to read design tokens and stay in sync with the layer's configuration.

Usage

const config = useXCards()

// Examples
config.colors.primary          // "cream"
config.defaults.filter         // "cinematic"
config.fonts.serif             // "'Playfair Display', ..."
config.brand.appName           // "My Brand"
config.spacing.baseUnit        // 4

Returns

KeyTypeDescription
colors.primarystringPrimary color name (default: "cream").
colors.neutralstringNeutral color name (default: "olive").
colors.accentsobjectAccent hex values: { gold, goldHover, blue, green }.
fonts.sansstringSans-serif font stack.
fonts.serifstringSerif font stack (Playfair Display).
fonts.displaystringDisplay font stack.
fonts.googleFontsUrlstringGoogle Fonts URL injected into <head>.
radius.cardstringBorder radius for card components.
radius.panelstringBorder radius for panel components.
spacing.baseUnitnumber4px grid base unit in pixels (default: 4).
defaults.filterstringDefault image filter: "cinematic", "moody", "golden", "cool", "dramatic", or "none".
defaults.overlaystringDefault overlay style applied to media cards.
defaults.mediaAspectRatiostringDefault aspect ratio for media cards.
defaults.productAspectRatiostringDefault aspect ratio for product cards.
brand.appNamestringApp name used in component titles.
brand.logoIconstringIconify icon class for the logo.

AI Context

composable: useXCards
package: "@xenterprises/nuxt-x-cards"
use-when: >
  Reading design tokens at runtime inside a custom component that should
  stay aligned with the nuxt-x-cards configuration. All built-in XCard*
  components call this internally to source their colors, fonts, radius,
  spacing, and defaults. Consumer overrides in app.config.ts under x.cards
  are automatically reflected here via defu deep-merge — no manual syncing
  needed. Use config.defaults.filter to read the configured image filter
  default, or config.colors.accents.gold to read the accent gold value.
Copyright © 2026