Label
The Label component is a flexible text display component with full theming support, responsive font sizing, and extensive styling options.
Featuresβ
- π¨ Theme color variants
- π Responsive font sizes
- π€ Font family and weight
- π Text alignment
- βοΈ Text truncation
- π― Letter spacing
Basic Usageβ
import { Label } from '@tansuk/rott-ui';
<Label text="Hello World" />
Font Sizesβ
<Label text="Extra Small" fontSize="xs" />
<Label text="Small" fontSize="sm" />
<Label text="Medium" fontSize="md" />
<Label text="Large" fontSize="lg" />
<Label text="Extra Large" fontSize="xl" />
<Label text="2X Large" fontSize="xxl" />
<Label text="3X Large" fontSize="xxxl" />
Color Variantsβ
<Label text="Primary" variant="primary" />
<Label text="Secondary" variant="secondary" />
<Label text="Danger" variant="danger" />
<Label text="Success" variant="success" />
<Label text="Grey" variant="grey-900" />
Font Weightβ
<Label text="Regular" fontWeight="regular" />
<Label text="Medium" fontWeight="medium" />
<Label text="Bold" fontWeight="bold" />
Text Alignmentβ
<Label text="Left Aligned" />
<Label text="Center Aligned" textCenter />
<Label text="Right Aligned" textAlign="right" />
Text Truncationβ
<Label
text="This is a very long text that will be truncated"
numberOfLines={1}
/>
Propsβ
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | - | Text to display |
variant | Variant | 'grey-900' | Color variant |
fontSize | FontSize | 'md' | Font size |
fontWeight | FontWeight | 'regular' | Font weight |
textCenter | boolean | false | Center align |
numberOfLines | number | - | Max lines |
Examplesβ
Headingβ
<Label
text="Page Title"
fontSize="3xl"
fontWeight="bold"
marginBottom={16}
/>
Error Messageβ
<Label
text="This field is required"
fontSize="sm"
variant="danger"
marginTop={4}
/>
Success Messageβ
<Label
text="β Changes saved"
fontSize="md"
variant="success"
textCenter
/>