useTagProps powers the Tag component under the hood. It splits incoming props into DOM props vs. CSS props, turns the CSS props into a class name (via css), and returns a DOM-safe prop bag you can spread into any element.
ts
const { props, style, themeStyle } = useTagProps<T extends TagComponentType = 'div'>(config: TagPropsRoot<T>)sx, sxr, style, hover, className, classNames, baseClass, theme from the props; everything else is rest.rest into DOM props vs. CSS props by checking each key against cssPropList.css({ ...sxr, ...cssProps, ...sx, ...style, '&:hover': hover }) to produce the element's class name.theme was passed, builds a second css({ '@global': { [.${classname}]: ThemeCssVars(createTheme(theme)) } }) call so that instance gets its own theme variables.xui-${baseClass} → classNames → className → the generated hash class.className.tsx
import { useTagProps } from 'xanui-core' export const PrimitiveButton = (rawProps) => { const { props } = useTagProps({ component: 'button', baseClass: 'button', sxr: { display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }, sx: { px: , py: , radius: 'sm', gap: , cursor: 'pointer', bgcolor: 'brand.primary', color: 'brand.contrast', }, hover: { bgcolor: 'brand.secondary' }, ...rawProps, }) return <button {...props} />}Use this hook whenever you build custom primitives that need the same prop ergonomics as Tag without going through the Tag component itself.