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
Skeleton
Use to show a placeholder while content is loading.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmSkeletonImports } from '@spartan-ng/helm/skeleton';
@Component({
selector: 'spartan-skeleton-preview',
imports: [HlmSkeletonImports],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="flex items-center gap-4">
<hlm-skeleton class="size-12 rounded-full" />
<div class="space-y-2">
<hlm-skeleton class="h-4 w-[250px]" />
<hlm-skeleton class="h-4 w-[200px]" />
</div>
</div>
`,
})
export class SkeletonPreview {}Installation
ng g @spartan-ng/cli:ui skeletonnx g @spartan-ng/cli:ui skeletonimport { OVERLAY_DEFAULT_CONFIG } from '@angular/cdk/overlay';
import { brnClasses, type BrnClassesOptions } from '@spartan-ng/brain/core';
import { cn, type ClassValue } from 'cn';
import { createCn } from 'cn/config';
import { makeEnvironmentProviders, type EnvironmentProviders } from '@angular/core';
import { provideSpartanHlm } from '@spartan-ng/helm/utils';
/**
* Merges class values and resolves Tailwind CSS conflicts.
*
* To customize the merge (e.g. register custom theme values), create your own instance:
*
* @example
* ```ts
*
*
* export const hlm = createCn({
* extend: { classGroups: { 'font-size': [{ text: ['hero'] }] } },
* });
* ```
*/
export const hlm = cn;
/**
* This function dynamically adds and removes classes for a given element without requiring
* the a class binding (e.g. `[class]="..."`) which may interfere with other class bindings.
* The classes are merged with `hlm`.
*/
export function classes(computed: () => ClassValue[] | string, options: Omit<BrnClassesOptions, 'merge'> = {}) {
brnClasses(computed, { ...options, merge: hlm });
}
/**
* Provides default configuration for Spartan Helm components.
*
* This utility configures the Angular CDK overlay to disable the `usePopover`
* behavior introduced in Angular 21, which causes CDK overlay-based components
* (sheets, dialogs, tooltips, etc.) to render above `position: fixed` elements
* like `<hlm-toaster>`.
*
* @returns {EnvironmentProviders} Environment providers to be added to the application config.
*
* @example
* ```ts
* // app.config.ts
*
*
* export const appConfig: ApplicationConfig = {
* providers: [
* provideSpartanHlm(),
* // ... other providers
* ],
* };
* ```
*/
export function provideSpartanHlm(): EnvironmentProviders {
return makeEnvironmentProviders([
{
provide: OVERLAY_DEFAULT_CONFIG,
useValue: { usePopover: false },
},
]);
}import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmSkeleton],hlm-skeleton',
exportAs: 'hlmSkeleton',
host: {
'data-slot': 'skeleton',
},
})
export class HlmSkeleton {
constructor() {
classes(() => 'bg-muted rounded-md block motion-safe:animate-pulse');
}
}
export const HlmSkeletonImports = [HlmSkeleton] as const;import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmSkeleton],hlm-skeleton',
exportAs: 'hlmSkeleton',
host: {
'data-slot': 'skeleton',
},
})
export class HlmSkeleton {
constructor() {
classes(() => 'bg-muted rounded-md block motion-safe:animate-pulse');
}
}
export const HlmSkeletonImports = [HlmSkeleton] as const;import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmSkeleton],hlm-skeleton',
exportAs: 'hlmSkeleton',
host: {
'data-slot': 'skeleton',
},
})
export class HlmSkeleton {
constructor() {
classes(() => 'bg-muted rounded-none block motion-safe:animate-pulse');
}
}
export const HlmSkeletonImports = [HlmSkeleton] as const;import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmSkeleton],hlm-skeleton',
exportAs: 'hlmSkeleton',
host: {
'data-slot': 'skeleton',
},
})
export class HlmSkeleton {
constructor() {
classes(() => 'bg-muted rounded-xl block motion-safe:animate-pulse');
}
}
export const HlmSkeletonImports = [HlmSkeleton] as const;import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmSkeleton],hlm-skeleton',
exportAs: 'hlmSkeleton',
host: {
'data-slot': 'skeleton',
},
})
export class HlmSkeleton {
constructor() {
classes(() => 'bg-muted rounded-md block motion-safe:animate-pulse');
}
}
export const HlmSkeletonImports = [HlmSkeleton] as const;import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmSkeleton],hlm-skeleton',
exportAs: 'hlmSkeleton',
host: {
'data-slot': 'skeleton',
},
})
export class HlmSkeleton {
constructor() {
classes(() => 'bg-muted rounded-2xl block motion-safe:animate-pulse');
}
}
export const HlmSkeletonImports = [HlmSkeleton] as const;Usage
import { HlmSkeletonImports } from '@spartan-ng/helm/skeleton';<hlm-skeleton class="h-[20px] w-[100px] rounded-full" />Examples
Avatar
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmSkeletonImports } from '@spartan-ng/helm/skeleton';
@Component({
selector: 'spartan-skeleton-avatar',
imports: [HlmSkeletonImports],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="flex w-fit items-center gap-4">
<hlm-skeleton class="size-10 shrink-0 rounded-full" />
<div class="grid gap-2">
<hlm-skeleton class="h-4 w-[150px]" />
<hlm-skeleton class="h-4 w-[100px]" />
</div>
</div>
`,
})
export class SkeletonAvatar {}Card
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmCardImports } from '@spartan-ng/helm/card';
import { HlmSkeletonImports } from '@spartan-ng/helm/skeleton';
@Component({
selector: 'spartan-skeleton-card',
imports: [HlmSkeletonImports, HlmCardImports],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'w-full max-w-xs',
},
template: `
<hlm-card class="w-full max-w-xs">
<hlm-card-header>
<hlm-skeleton class="h-4 w-2/3" />
<hlm-skeleton class="h-4 w-1/2" />
</hlm-card-header>
<div hlmCardContent>
<hlm-skeleton class="aspect-video w-full" />
</div>
</hlm-card>
`,
})
export class SkeletonCard {}Text
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmSkeletonImports } from '@spartan-ng/helm/skeleton';
@Component({
selector: 'spartan-skeleton-text',
imports: [HlmSkeletonImports],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'w-full max-w-xs',
},
template: `
<div class="flex w-full max-w-xs flex-col gap-2">
<hlm-skeleton class="h-4 w-full" />
<hlm-skeleton class="h-4 w-full" />
<hlm-skeleton class="h-4 w-3/4" />
</div>
`,
})
export class SkeletonText {}Form
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmSkeletonImports } from '@spartan-ng/helm/skeleton';
@Component({
selector: 'spartan-skeleton-form',
imports: [HlmSkeletonImports],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'w-full max-w-xs',
},
template: `
<div class="flex w-full max-w-xs flex-col gap-7">
<div class="flex flex-col gap-3">
<hlm-skeleton class="h-4 w-20" />
<hlm-skeleton class="h-8 w-full" />
</div>
<div class="flex flex-col gap-3">
<hlm-skeleton class="h-4 w-24" />
<hlm-skeleton class="h-8 w-full" />
</div>
<hlm-skeleton class="h-8 w-24" />
</div>
`,
})
export class SkeletonForm {}Table
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmSkeletonImports } from '@spartan-ng/helm/skeleton';
@Component({
selector: 'spartan-skeleton-table',
imports: [HlmSkeletonImports],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'w-full max-w-xs',
},
template: `
<div class="flex w-full max-w-sm flex-col gap-2">
@for (row of _rows; track $index) {
<div class="flex gap-4">
<hlm-skeleton class="h-4 flex-1" />
<hlm-skeleton class="h-4 w-24" />
<hlm-skeleton class="h-4 w-20" />
</div>
}
</div>
`,
})
export class SkeletonTable {
protected readonly _rows = Array.from({ length: 5 });
}RTL
To enable RTL support in spartan-ng, see the RTL configuration guide.
import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
import { TranslateService, Translations } from '@spartan-ng/app/app/shared/translate.service';
import { HlmSkeletonImports } from '@spartan-ng/helm/skeleton';
@Component({
selector: 'spartan-skeleton-rtl',
imports: [HlmSkeletonImports],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="flex w-fit items-center gap-4" [dir]="_dir()">
<hlm-skeleton class="size-10 shrink-0 rounded-full" />
<div class="grid gap-2">
<hlm-skeleton class="h-4 w-[150px]" />
<hlm-skeleton class="h-4 w-[100px]" />
</div>
</div>
`,
})
export class SkeletonRtl {
private readonly _language = inject(TranslateService).language;
private readonly _translations: Translations = {
en: {
dir: 'ltr',
values: {},
},
ar: {
dir: 'rtl',
values: {},
},
he: {
dir: 'rtl',
values: {},
},
};
private readonly _translation = computed(() => this._translations[this._language()]);
protected readonly _dir = computed(() => this._translation().dir);
}Helm API
HlmSkeleton
Selector: [hlmSkeleton],hlm-skeleton
ExportAs: hlmSkeleton
On This Page
Stop configuring. Start shipping.
Zerops powers spartan.ng and Angular teams worldwide.
One-command deployment. Zero infrastructure headaches.
Deploy with Zerops