Velocity UI
Loading…
Menu

Text

Text component with smooth animations and modern UI.

Installation

Add this component to your project using the CLI:

terminal
npx vui-registry-cli-v1 add text

Source Code

text.tsx
'use client'

import React from 'react'
import { cn } from '@/lib/utils'

export interface TextProps extends React.HTMLAttributes<HTMLElement> {
  as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span'
  className?: string
  children: React.ReactNode
}

/**
 * Base Text Component
 * A foundational text component that serves as the primitive for text variants.
 */
export function Text({ as: Component = 'p', className, children, ...props }: TextProps) {
  return (
    <Component className={cn('text-foreground', className)} {...props}>
      {children}
    </Component>
  )
}