X Enterprises
Composables

useXUI

Runtime access to design tokens from app.config.ts — fonts, typography, spacing, border radius, and animation durations.

useXUI

Returns the xUI namespace from app.config.ts, giving JavaScript/TypeScript access to the same design tokens that are also exposed as CSS custom properties. Use it in components, composables, or scripts to read token values programmatically without hardcoding them. Consumer layers that override tokens in their own app.config.ts will see those overrides reflected here automatically.

Usage

<script setup>
const { fonts, typography, spacing, radius, duration } = useXUI()
</script>

Returns

KeyTypeDescription
fonts.displaystringDisplay font family (default: Mona Sans).
fonts.bodystringBody font family (default: Mona Sans).
fonts.monostringMonospace font family (default: Hubot Sans).
typography.displayobjectDisplay scale tokens: { size, lineHeight, tracking, weight }.
typography.headlineobjectHeadline scale tokens.
typography.titleobjectTitle scale tokens.
typography.bodyobjectBody scale tokens.
typography.smallobjectSmall text scale tokens.
typography.captionobjectCaption scale tokens.
spacing.xsstringExtra-small spacing (0.25rem).
spacing.smstringSmall spacing (0.5rem).
spacing.mdstringBase spacing (1rem).
spacing.lgstringLarge spacing (1.5rem).
spacing.xlstringExtra-large spacing (2rem).
spacing['2xl']string2x extra-large spacing (3rem).
spacing['3xl']string3x extra-large spacing (4rem).
radius.smstringSmall border radius (0.375rem).
radius.mdstringMedium border radius (0.5rem).
radius.lgstringLarge border radius (0.75rem).
radius.xlstringExtra-large border radius (1rem).
radius.fullstringFull/pill border radius (9999px).
duration.instantstringInstant animation duration (100ms).
duration.faststringFast animation duration (150ms).
duration.normalstringNormal animation duration (250ms).
duration.slowstringSlow animation duration (400ms).
duration.slowerstringSlower animation duration (700ms).

AI Context

composable: useXUI
package: "xlayer-ui"
use-when: >
  Accessing xlayer-ui design tokens at runtime in JavaScript or TypeScript.
  Use when you need to pass a token value as a prop, use it in a computed
  property, or apply it dynamically where CSS custom properties are not
  sufficient (e.g. inline canvas drawing, chart configuration, JS-driven
  animations). All other xlayers (nuxt-x-cards, nuxt-x-blog, etc.) extend
  xlayer-ui and inherit these tokens automatically — no manual import needed.
  Consumer overrides in app.config.ts under the xUI namespace are reflected
  here immediately.
Copyright © 2026