Components
Label
Combine a title with an optional icon.
Example
Requires React 18.2+ or 19 and shared styles. See setup.
Default
Loading preview…
Code
'use client';
import { Label } from '@swiftuijs/ui';
export default function Example() {
return (<Label icon="🏠" title="Home"></Label>);
}Variants
Label supports different display variants:
Usage and limitations
titleis required;iconis optional. Variants areautomatic(default),iconOnly, andtitleOnly.- Spacing and alignment are supplied by the component; choose an icon that matches the title.
- This renders a visual container, not an HTML
labelassociated with a form input. Label inputs separately; icon-only controls still need an accessible name.
More examples
Icon Only
Title Only
API reference
| Prop | Type | Required | Description |
|---|---|---|---|
icon | ReactNode | No | Label icon |
title | string | Yes | Label text |
variant | 'automatic' | 'iconOnly' | 'titleOnly' | No | Label style variant Default: 'automatic' |
style | IBaseComponent['style'] | No | Custom CSS style (overrides variant) |
Inherits additional props from Omit<IBaseComponent, 'style'>.