GLASS // NEXTUI
Text
Polymorphic text primitive with body, caption, label, and code variants styled for the GLASS dark glassmorphism palette.
$
Or install the base component for free:
Live Preview
Open full demoUsage
TSX
<Text variant="body">Your content renders here.</Text>Variants
<Text variant="body">Your content renders here.</Text>
<Text variant="caption" as="span">Last synced 5 minutes ago</Text>
<Text variant="label" as="span">Region</Text>
<Text variant="code" as="span">us-east-1</Text>
Source
TSX
import { cn } from '@/lib/utils'
type TextVariant = 'body' | 'caption' | 'label' | 'code'
type TextElement = 'p' | 'span' | 'div' | 'h2' | 'h3' | 'h4'
interface TextProps {
children: React.ReactNode
variant?: TextVariant
as?: TextElement
className?: string
}
const variantClass: Record<TextVariant, string> = {
body: 'text-body',
caption: 'text-caption',
label: 'text-label',
code: 'text-code',
}
export function Text({
children,
variant = 'body',
as: Tag = 'p',
className,
}: TextProps): React.JSX.Element {
return (
<Tag className={cn(variantClass[variant], className)}>
{children}
</Tag>
)
}
Works withNext.js 15React 19Tailwind v4TypeScript 5
More from GLASS // NEXT
Button
Glassmorphism button with primary, secondary, and ghost variants in three sizes. Renders as a Next.js Link when an href is provided.
Badge
Frosted-glass badge with sky, indigo, cyan, violet, and emerald variants for tags and status indicators.
Card
Composable glassmorphism card container with frosted-glass surface and header, body, and footer sub-components.