Spartans get ready! v1 is coming!
We are very close to our first stable release. Expect more announcements in the coming weeks. v1 was made possible by our partner Zerops.
Getting Started
Stack
Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Dropdown Menu
- Empty
- Form Field
- Hover Card
- Icon
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Label
- Menubar
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner (Toast)
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
Badge
Makes a component look like a badge.
BadgeSecondaryDestructiveOutline
import { Component } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { lucideBadgeCheck } from '@ng-icons/lucide';
import { HlmBadgeImports } from '@spartan-ng/helm/badge';
@Component({
selector: 'spartan-badge-preview',
imports: [HlmBadgeImports, NgIcon],
providers: [provideIcons({ lucideBadgeCheck })],
template: `
<div class="flex flex-col items-center gap-2">
<div class="flex w-full flex-wrap gap-2">
<span hlmBadge>Badge</span>
<span hlmBadge variant="secondary">Secondary</span>
<span hlmBadge variant="destructive">Destructive</span>
<span hlmBadge variant="outline">Outline</span>
</div>
<div class="flex w-full flex-wrap gap-2">
<span hlmBadge variant="secondary" class="bg-blue-500 text-white dark:bg-blue-600">
<ng-icon name="lucideBadgeCheck" />
Verified
</span>
<span hlmBadge class="h-5 min-w-5 rounded-full px-1 font-mono tabular-nums">8</span>
<span hlmBadge class="h-5 min-w-5 rounded-full px-1 font-mono tabular-nums" variant="destructive">99</span>
<span hlmBadge class="h-5 min-w-5 rounded-full px-1 font-mono tabular-nums" variant="outline">20+</span>
</div>
</div>
`,
})
export class BadgePreview {}Installation
npx nx g @spartan-ng/cli:ui badge
ng g @spartan-ng/cli:ui badge
Usage
import { HlmBadgeImports } from '@spartan-ng/helm/badge';<span hlmBadge variant="default | outline | secondary | destructive">Badge</span>Examples
Link
import { Component } from '@angular/core';
import { RouterLink } from '@angular/router';
import { HlmBadgeImports } from '@spartan-ng/helm/badge';
@Component({
selector: 'spartan-badge-link',
imports: [HlmBadgeImports, RouterLink],
template: `
<div class="flex gap-2">
<a hlmBadge routerLink=".">Angular Route</a>
<a hlmBadge variant="secondary" href="https://spartan.ng">External Link</a>
</div>
`,
})
export class BadgeLink {}Helm API
HlmBadge
Selector: [hlmBadge]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
| variant | BadgeVariants['variant'] | default | - |