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
- Field
- Form Field
- Hover Card
- Icon
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Label
- Menubar
- Navigation Menu
- 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
Alert
Displays a callout for user attention.
Success! Your changes have been saved
This is an alert with icon, title and description.
This Alert has a title and an icon. No description.
Unable to process your payment.
Please verify your billing information and try again.
- Check your card details
- Ensure sufficient funds
- Verify billing address
import { Component } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { lucideCircleAlert, lucideCircleCheck, lucidePopcorn } from '@ng-icons/lucide';
import { HlmAlertImports } from '@spartan-ng/helm/alert';
import { HlmIcon } from '@spartan-ng/helm/icon';
@Component({
selector: 'spartan-alert-preview',
imports: [HlmAlertImports, NgIcon, HlmIcon],
providers: [provideIcons({ lucideCircleCheck, lucidePopcorn, lucideCircleAlert })],
template: `
<div class="grid w-full max-w-xl items-start gap-4">
<div hlmAlert>
<ng-icon hlm hlmAlertIcon name="lucideCircleCheck" />
<h4 hlmAlertTitle>Success! Your changes have been saved</h4>
<p hlmAlertDescription>This is an alert with icon, title and description.</p>
</div>
<div hlmAlert>
<ng-icon hlm hlmAlertIcon name="lucidePopcorn" />
<h4 hlmAlertTitle>This Alert has a title and an icon. No description.</h4>
</div>
<div hlmAlert variant="destructive">
<ng-icon hlm hlmAlertIcon name="lucideCircleAlert" />
<h4 hlmAlertTitle>Unable to process your payment.</h4>
<div hlmAlertDescription>
<p>Please verify your billing information and try again.</p>
<ul class="list-inside list-disc text-sm">
<li>Check your card details</li>
<li>Ensure sufficient funds</li>
<li>Verify billing address</li>
</ul>
</div>
</div>
</div>
`,
})
export class AlertPreview {}Installation
npx nx g @spartan-ng/cli:ui alert
ng g @spartan-ng/cli:ui alert
Usage
import { HlmAlertImports } from '@spartan-ng/helm/alert';<div hlmAlert variant="default | destructive">
<ng-icon hlm hlmAlertIcon name="lucideCircleCheck" />
<h4 hlmAlertTitle>Success! Your changes have been saved</h4>
<div hlmAlertDescription>This is an alert with icon, title and description.</div>
</div>Examples
Destructive
Unexpected Error
Your session has expired. Please log in again.
import { Component } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { lucideTriangleAlert } from '@ng-icons/lucide';
import { HlmAlert, HlmAlertDescription, HlmAlertIcon, HlmAlertTitle } from '@spartan-ng/helm/alert';
import { HlmIcon } from '@spartan-ng/helm/icon';
@Component({
selector: 'spartan-alert-destructive',
imports: [HlmAlertDescription, HlmAlert, HlmAlertIcon, HlmAlertTitle, NgIcon, HlmIcon],
providers: [provideIcons({ lucideTriangleAlert })],
template: `
<div hlmAlert variant="destructive">
<ng-icon hlm hlmAlertIcon name="lucideTriangleAlert" />
<h4 hlmAlertTitle>Unexpected Error</h4>
<p hlmAlertDescription>Your session has expired. Please log in again.</p>
</div>
`,
})
export class AlertDestructive {}Helm API
HlmAlertDescription
Selector: [hlmAlertDesc],[hlmAlertDescription]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmAlertIcon
Selector: [hlmAlertIcon]
HlmAlertTitle
Selector: [hlmAlertTitle]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmAlert
Selector: [hlmAlert]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
| variant | AlertVariants['variant'] | default | - |