Getting Started
UI
Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Code Block
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Questionnaire
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner (Toast)
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
- Trace
Utilities
Forms
Stack
Label
Gives the label a distinct look.
import { Component } from '@angular/core';
import { HlmCheckboxImports } from '@spartan-ng/helm/checkbox';
import { HlmLabelImports } from '@spartan-ng/helm/label';
@Component({
selector: 'spartan-label-preview',
imports: [HlmLabelImports, HlmCheckboxImports],
template: `
<div class="flex gap-2">
<hlm-checkbox inputId="terms" />
<label hlmLabel for="terms">Accept terms and conditions</label>
</div>
`,
})
export class LabelPreview {}Installation
ng g @spartan-ng/cli:ui labelnx g @spartan-ng/cli:ui labelUsage
import { HlmLabelImports } from '@spartan-ng/helm/label';<label hlmLabel for="email">Your email address</label>RTL
To enable RTL support in spartan-ng, see the RTL configuration guide.
import { Component, computed, inject } from '@angular/core';
import { TranslateService, Translations } from '@spartan-ng/app/app/shared/translate.service';
import { HlmCheckboxImports } from '@spartan-ng/helm/checkbox';
import { HlmLabelImports } from '@spartan-ng/helm/label';
@Component({
selector: 'spartan-label-rtl',
imports: [HlmLabelImports, HlmCheckboxImports],
template: `
<div class="flex gap-2" [dir]="_dir()">
<hlm-checkbox inputId="terms-rtl" />
<label hlmLabel for="terms-rtl">{{ _t()['label'] }}</label>
</div>
`,
})
export class LabelRtl {
private readonly _language = inject(TranslateService).language;
private readonly _translations: Translations = {
en: {
dir: 'ltr',
values: {
label: 'Accept terms and conditions',
},
},
ar: {
dir: 'rtl',
values: {
label: 'قبول الشروط والأحكام',
},
},
he: {
dir: 'rtl',
values: {
label: 'קבל תנאים והגבלות',
},
},
};
private readonly _translation = computed(() => this._translations[this._language()]);
protected readonly _t = computed(() => this._translation().values);
protected readonly _dir = computed(() => this._translation().dir);
}Brain API
BrnLabel
Selector: [brnLabel]
ExportAs: brnLabel
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | `brn-label-${++BrnLabel._id}` | The id of the label. |
| for | string | - | The id of the form control this label is associated with. |
Helm API
HlmLabel
Selector: [hlmLabel]
ExportAs: hlmLabel
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | `brn-label-${++BrnLabel._id}` | The id of the label. |
| for | string | - | The id of the form control this label is associated with. |
On This Page
Stop configuring. Start shipping.
Zerops powers spartan.ng and Angular teams worldwide.
One-command deployment. Zero infrastructure headaches.
Deploy with Zerops