UIText
UIText Components
A collection of text components that provide consistent typography styles across the application, with various sizes and weights.
<template> <div class="space-y-4"> <UITextXlMedium> Extra Large Medium Text </UITextXlMedium>
<UITextLgMedium> Large Medium Text </UITextLgMedium>
<UITextMdMedium> Medium Medium Text </UITextMdMedium>
<UITextSmMedium> Small Medium Text </UITextSmMedium>
<UITextXlNormal> Extra Large Normal Text </UITextXlNormal>
<UITextLgNormal> Large Normal Text </UITextLgNormal>
<UITextMdNormal> Medium Normal Text </UITextMdNormal>
<UITextSmNormal> Small Normal Text </UITextSmNormal> </div></template>Components
Size Variants
- Extra Large (XL):
UITextXlMedium: 20px, medium weightUITextXlNormal: 20px, normal weight
- Large (LG):
UITextLgMedium: 18px, medium weightUITextLgNormal: 18px, normal weight
- Medium (MD):
UITextMdMedium: 16px, medium weightUITextMdNormal: 16px, normal weight
- Small (SM):
UITextSmMedium: 14px, medium weightUITextSmNormal: 14px, normal weight
Props
Common props for all text components:
truncate(boolean): Enable text truncationclamp(number): Number of lines to clampas(string): HTML element to render ascolor(string): Text color classalign(‘left’ | ‘center’ | ‘right’): Text alignment
Usage Examples
- Basic Text:
<template> <UITextLgMedium> Section Title </UITextLgMedium> <UITextSmNormal> Section description or content </UITextSmNormal></template>- Truncated Text:
<template> <UITextMdNormal :truncate="true" class="max-w-md" > This is a very long text that will be truncated when it exceeds the container width </UITextMdNormal></template>- Line Clamping:
<template> <UITextMdNormal :clamp="2"> This is a multi-line text that will be clamped to two lines. Any content beyond the second line will be truncated with an ellipsis. </UITextMdNormal></template>- Custom Element:
<template> <UITextLgMedium as="h2"> Section Heading </UITextLgMedium></template>- Card Content:
<template> <UICard> <UITextLgMedium class="mb-2"> Card Title </UITextLgMedium> <UITextSmNormal class="text-gray-600"> Card description or content that provides more details about the card's purpose. </UITextSmNormal> </UICard></template>Best Practices
-
Typography Hierarchy:
- Use consistent sizes for similar content
- Maintain clear visual hierarchy
- Follow design system guidelines
- Consider content importance
-
Readability:
- Ensure sufficient contrast
- Use appropriate line height
- Consider font scaling
- Maintain readable lengths
-
Responsive Design:
- Adjust sizes for mobile
- Handle text overflow
- Consider line breaks
- Use appropriate spacing
-
Accessibility:
- Use semantic elements
- Maintain color contrast
- Support font scaling
- Consider screen readers
-
Content Structure:
- Group related text
- Use consistent spacing
- Consider content flow
- Handle dynamic content