LAB // NEXTUI
Text
Polymorphic text primitive with body, caption, label, and code variants styled for the LAB dark scientific palette.
$
Or install the base component for free:
Live Preview
Open full demoUsage
TSX
<Text variant="code" as="span">npm run experiment</Text>Variants
<Text variant="body">Body copy renders here.</Text>
<Text variant="caption" as="span">EXP-07 initialized</Text>
<Text variant="label" as="span">Protocol</Text>
<Text variant="code" as="span">npm run experiment</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 LAB // NEXT
Button
Scientific dark-theme button with primary, secondary, and ghost variants in three sizes. Renders as a Next.js Link when an href is provided.
Badge
Lab-aesthetic badge with green and blue pill variants for experiment tags and status markers.
Card
Feature card with an experiment code label, SVG icon (atom, grid, diamond, network, monitor, warning), description, and a colored pill tag.