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
Separator
Visually or semantically separates content.
spartan/ui
An open-source UI component library.
A set of beautifully designed components that you can customize, extend, and build on.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmSeparatorImports } from '@spartan-ng/helm/separator';
@Component({
selector: 'spartan-separator-preview',
imports: [HlmSeparatorImports],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="flex max-w-sm flex-col gap-4 text-sm">
<div class="flex flex-col gap-1.5">
<div class="leading-none font-medium">spartan/ui</div>
<div class="text-muted-foreground">An open-source UI component library.</div>
</div>
<hlm-separator />
<div>A set of beautifully designed components that you can customize, extend, and build on.</div>
</div>
`,
})
export class SeparatorPreview {}Installation
ng g @spartan-ng/cli:ui separatornx g @spartan-ng/cli:ui separatorimport { 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 { BrnSeparator } from '@spartan-ng/brain/separator';
import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
export const hlmSeparatorClass =
'inline-flex shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch';
@Directive({
selector: '[hlmSeparator],hlm-separator',
exportAs: 'hlmSeparator',
hostDirectives: [{ directive: BrnSeparator, inputs: ['orientation', 'decorative'] }],
host: {
'data-slot': 'separator',
},
})
export class HlmSeparator {
constructor() {
classes(() => hlmSeparatorClass);
}
}
export const HlmSeparatorImports = [HlmSeparator] as const;import { BrnSeparator } from '@spartan-ng/brain/separator';
import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
export const hlmSeparatorClass =
'inline-flex shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch';
@Directive({
selector: '[hlmSeparator],hlm-separator',
exportAs: 'hlmSeparator',
hostDirectives: [{ directive: BrnSeparator, inputs: ['orientation', 'decorative'] }],
host: {
'data-slot': 'separator',
},
})
export class HlmSeparator {
constructor() {
classes(() => hlmSeparatorClass);
}
}
export const HlmSeparatorImports = [HlmSeparator] as const;import { BrnSeparator } from '@spartan-ng/brain/separator';
import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
export const hlmSeparatorClass =
'inline-flex shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch';
@Directive({
selector: '[hlmSeparator],hlm-separator',
exportAs: 'hlmSeparator',
hostDirectives: [{ directive: BrnSeparator, inputs: ['orientation', 'decorative'] }],
host: {
'data-slot': 'separator',
},
})
export class HlmSeparator {
constructor() {
classes(() => hlmSeparatorClass);
}
}
export const HlmSeparatorImports = [HlmSeparator] as const;import { BrnSeparator } from '@spartan-ng/brain/separator';
import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
export const hlmSeparatorClass =
'inline-flex shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch';
@Directive({
selector: '[hlmSeparator],hlm-separator',
exportAs: 'hlmSeparator',
hostDirectives: [{ directive: BrnSeparator, inputs: ['orientation', 'decorative'] }],
host: {
'data-slot': 'separator',
},
})
export class HlmSeparator {
constructor() {
classes(() => hlmSeparatorClass);
}
}
export const HlmSeparatorImports = [HlmSeparator] as const;import { BrnSeparator } from '@spartan-ng/brain/separator';
import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
export const hlmSeparatorClass =
'inline-flex shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch';
@Directive({
selector: '[hlmSeparator],hlm-separator',
exportAs: 'hlmSeparator',
hostDirectives: [{ directive: BrnSeparator, inputs: ['orientation', 'decorative'] }],
host: {
'data-slot': 'separator',
},
})
export class HlmSeparator {
constructor() {
classes(() => hlmSeparatorClass);
}
}
export const HlmSeparatorImports = [HlmSeparator] as const;import { BrnSeparator } from '@spartan-ng/brain/separator';
import { Directive } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
export const hlmSeparatorClass =
'inline-flex shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch';
@Directive({
selector: '[hlmSeparator],hlm-separator',
exportAs: 'hlmSeparator',
hostDirectives: [{ directive: BrnSeparator, inputs: ['orientation', 'decorative'] }],
host: {
'data-slot': 'separator',
},
})
export class HlmSeparator {
constructor() {
classes(() => hlmSeparatorClass);
}
}
export const HlmSeparatorImports = [HlmSeparator] as const;Usage
import { HlmSeparatorImports } from '@spartan-ng/helm/separator';<hlm-separator />Examples
Vertical
Blog
Docs
Source
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmSeparatorImports } from '@spartan-ng/helm/separator';
@Component({
selector: 'spartan-separator-vertical',
imports: [HlmSeparatorImports],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="flex h-5 items-center gap-4 text-sm">
<div>Blog</div>
<hlm-separator orientation="vertical" />
<div>Docs</div>
<hlm-separator orientation="vertical" />
<div>Source</div>
</div>
`,
})
export class SeparatorVerticalPreview {}Menu
SettingsManage preferences
AccountProfile & security
HelpSupport & docs
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmSeparatorImports } from '@spartan-ng/helm/separator';
@Component({
selector: 'spartan-separator-menu',
imports: [HlmSeparatorImports],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="flex items-center gap-2 text-sm md:gap-4">
<div class="flex flex-col gap-1">
<span class="font-medium">Settings</span>
<span class="text-muted-foreground text-xs">Manage preferences</span>
</div>
<hlm-separator orientation="vertical" />
<div class="flex flex-col gap-1">
<span class="font-medium">Account</span>
<span class="text-muted-foreground text-xs">Profile & security</span>
</div>
<hlm-separator orientation="vertical" class="hidden md:block" />
<div class="hidden flex-col gap-1 md:flex">
<span class="font-medium">Help</span>
<span class="text-muted-foreground text-xs">Support & docs</span>
</div>
</div>
`,
})
export class SeparatorMenuPreview {}List
- Item 1
- Value 1
- Item 2
- Value 2
- Item 3
- Value 3
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmSeparatorImports } from '@spartan-ng/helm/separator';
@Component({
selector: 'spartan-separator-list',
imports: [HlmSeparatorImports],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'flex w-full max-w-sm flex-col gap-2 text-sm',
},
template: `
<dl class="flex items-center justify-between">
<dt>Item 1</dt>
<dd class="text-muted-foreground">Value 1</dd>
</dl>
<hlm-separator />
<dl class="flex items-center justify-between">
<dt>Item 2</dt>
<dd class="text-muted-foreground">Value 2</dd>
</dl>
<hlm-separator />
<dl class="flex items-center justify-between">
<dt>Item 3</dt>
<dd class="text-muted-foreground">Value 3</dd>
</dl>
`,
})
export class SeparatorListPreview {}RTL
To enable RTL support in spartan-ng, see the RTL configuration guide.
spartan/ui
الأساس لنظام التصميم الخاص بك
مجموعة من المكونات المصممة بشكل جميل يمكنك تخصيصها وتوسيعها والبناء عليها.
import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';
import { TranslateService, Translations } from '@spartan-ng/app/app/shared/translate.service';
import { HlmSeparatorImports } from '@spartan-ng/helm/separator';
@Component({
selector: 'spartan-separator-rtl',
imports: [HlmSeparatorImports],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="flex max-w-sm flex-col gap-4 text-sm" [dir]="_dir()">
<div class="flex flex-col gap-1.5">
<div class="leading-none font-medium">{{ _t()['title'] }}</div>
<div class="text-muted-foreground">{{ _t()['subtitle'] }}</div>
</div>
<hlm-separator />
<div>{{ _t()['description'] }}</div>
</div>
`,
})
export class SeparatorRtlPreview {
private readonly _language = inject(TranslateService).language;
private readonly _translations: Translations = {
en: {
dir: 'ltr',
values: {
title: 'spartan/ui',
subtitle: 'The Foundation for your Design System',
description: 'A set of beautifully designed components that you can customize, extend, and build on.',
},
},
ar: {
dir: 'rtl',
values: {
title: 'spartan/ui',
subtitle: 'الأساس لنظام التصميم الخاص بك',
description: 'مجموعة من المكونات المصممة بشكل جميل يمكنك تخصيصها وتوسيعها والبناء عليها.',
},
},
he: {
dir: 'rtl',
values: {
title: 'spartan/ui',
subtitle: 'הבסיס למערכת העיצוב שלך',
description: 'סט של רכיבים מעוצבים בצורה יפה שאתה יכול להתאים אישית, להרחיב ולבנות עליהם.',
},
},
};
private readonly _translation = computed(() => this._translations[this._language()]);
protected readonly _t = computed(() => this._translation().values);
protected readonly _dir = computed(() => this._translation().dir);
}Brain API
BrnSeparator
Selector: [brnSeparator],brn-separator
ExportAs: brnSeparator
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | SeparatorOrientation | this._config.orientation | Orientation of the separator. |
| decorative | boolean | true | Whether the separator is decorative. |
Helm API
HlmSeparator
Selector: [hlmSeparator],hlm-separator
ExportAs: hlmSeparator
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | SeparatorOrientation | this._config.orientation | Orientation of the separator. |
| decorative | boolean | true | Whether the separator is decorative. |
On This Page
Stop configuring. Start shipping.
Zerops powers spartan.ng and Angular teams worldwide.
One-command deployment. Zero infrastructure headaches.
Deploy with Zerops