- 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
Resizable
A group of resizable horizontal and vertical panels.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmResizableImports } from '@spartan-ng/helm/resizable';
@Component({
selector: 'spartan-resizable-example',
imports: [HlmResizableImports],
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'min-w-xs' },
template: `
<hlm-resizable-group class="max-w-md rounded-lg border">
<hlm-resizable-panel defaultSize="50">
<div class="flex h-[200px] items-center justify-center p-6">
<span class="font-semibold">One</span>
</div>
</hlm-resizable-panel>
<hlm-resizable-handle withHandle />
<hlm-resizable-panel defaultSize="50">
<hlm-resizable-group direction="vertical">
<hlm-resizable-panel defaultSize="25">
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">Two</span>
</div>
</hlm-resizable-panel>
<hlm-resizable-handle withHandle />
<hlm-resizable-panel defaultSize="75">
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">Three</span>
</div>
</hlm-resizable-panel>
</hlm-resizable-group>
</hlm-resizable-panel>
</hlm-resizable-group>
`,
})
export class ResizablePreviewComponent {}Installation
ng g @spartan-ng/cli:ui resizablenx g @spartan-ng/cli:ui resizableimport { 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 { BrnResizableGroup, BrnResizableHandle, BrnResizablePanel } from '@spartan-ng/brain/resizable';
import { ChangeDetectionStrategy, Component, Directive, inject } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmResizableGroup],hlm-resizable-group',
exportAs: 'hlmResizableGroup',
hostDirectives: [
{
directive: BrnResizableGroup,
inputs: ['direction', 'layout'],
outputs: ['dragEnd', 'dragStart', 'layoutChange'],
},
],
host: {
'data-slot': 'resizable-group',
},
})
export class HlmResizableGroup {
constructor() {
classes(() => 'group flex h-full w-full data-[panel-group-direction=vertical]:flex-col');
}
}
@Component({
selector: 'hlm-resizable-handle',
exportAs: 'hlmResizableHandle',
changeDetection: ChangeDetectionStrategy.OnPush,
hostDirectives: [{ directive: BrnResizableHandle, inputs: ['withHandle', 'disabled'] }],
host: {
'data-slot': 'resizable-handle',
},
template: `
@if (_brnResizableHandle.withHandle()) {
<div class="bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"></div>
}
`,
})
export class HlmResizableHandle {
protected readonly _brnResizableHandle = inject(BrnResizableHandle);
constructor() {
classes(() => [
'bg-border ring-offset-background focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90',
'data-[panel-group-direction=horizontal]:hover:cursor-ew-resize data-[panel-group-direction=vertical]:hover:cursor-ns-resize',
]);
}
}
@Directive({
selector: '[hlmResizablePanel],hlm-resizable-panel',
exportAs: 'hlmResizablePanel',
hostDirectives: [
{
directive: BrnResizablePanel,
inputs: ['defaultSize', 'id', 'collapsible', 'maxSize', 'minSize'],
},
],
host: {
'data-slot': 'resizable-panel',
},
})
export class HlmResizablePanel {
private readonly _resizablePanel = inject(BrnResizablePanel);
public setSize(size: number) {
this._resizablePanel.setSize(size);
}
}
export const HlmResizableImports = [HlmResizableGroup, HlmResizablePanel, HlmResizableHandle] as const;import { BrnResizableGroup, BrnResizableHandle, BrnResizablePanel } from '@spartan-ng/brain/resizable';
import { ChangeDetectionStrategy, Component, Directive, inject } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmResizableGroup],hlm-resizable-group',
exportAs: 'hlmResizableGroup',
hostDirectives: [
{
directive: BrnResizableGroup,
inputs: ['direction', 'layout'],
outputs: ['dragEnd', 'dragStart', 'layoutChange'],
},
],
host: {
'data-slot': 'resizable-group',
},
})
export class HlmResizableGroup {
constructor() {
classes(() => 'group flex h-full w-full data-[panel-group-direction=vertical]:flex-col');
}
}
@Component({
selector: 'hlm-resizable-handle',
exportAs: 'hlmResizableHandle',
changeDetection: ChangeDetectionStrategy.OnPush,
hostDirectives: [{ directive: BrnResizableHandle, inputs: ['withHandle', 'disabled'] }],
host: {
'data-slot': 'resizable-handle',
},
template: `
@if (_brnResizableHandle.withHandle()) {
<div class="bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"></div>
}
`,
})
export class HlmResizableHandle {
protected readonly _brnResizableHandle = inject(BrnResizableHandle);
constructor() {
classes(() => [
'bg-border ring-offset-background focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90',
'data-[panel-group-direction=horizontal]:hover:cursor-ew-resize data-[panel-group-direction=vertical]:hover:cursor-ns-resize',
]);
}
}
@Directive({
selector: '[hlmResizablePanel],hlm-resizable-panel',
exportAs: 'hlmResizablePanel',
hostDirectives: [
{
directive: BrnResizablePanel,
inputs: ['defaultSize', 'id', 'collapsible', 'maxSize', 'minSize'],
},
],
host: {
'data-slot': 'resizable-panel',
},
})
export class HlmResizablePanel {
private readonly _resizablePanel = inject(BrnResizablePanel);
public setSize(size: number) {
this._resizablePanel.setSize(size);
}
}
export const HlmResizableImports = [HlmResizableGroup, HlmResizablePanel, HlmResizableHandle] as const;import { BrnResizableGroup, BrnResizableHandle, BrnResizablePanel } from '@spartan-ng/brain/resizable';
import { ChangeDetectionStrategy, Component, Directive, inject } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmResizableGroup],hlm-resizable-group',
exportAs: 'hlmResizableGroup',
hostDirectives: [
{
directive: BrnResizableGroup,
inputs: ['direction', 'layout'],
outputs: ['dragEnd', 'dragStart', 'layoutChange'],
},
],
host: {
'data-slot': 'resizable-group',
},
})
export class HlmResizableGroup {
constructor() {
classes(() => 'group flex h-full w-full data-[panel-group-direction=vertical]:flex-col');
}
}
@Component({
selector: 'hlm-resizable-handle',
exportAs: 'hlmResizableHandle',
changeDetection: ChangeDetectionStrategy.OnPush,
hostDirectives: [{ directive: BrnResizableHandle, inputs: ['withHandle', 'disabled'] }],
host: {
'data-slot': 'resizable-handle',
},
template: `
@if (_brnResizableHandle.withHandle()) {
<div class="bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"></div>
}
`,
})
export class HlmResizableHandle {
protected readonly _brnResizableHandle = inject(BrnResizableHandle);
constructor() {
classes(() => [
'bg-border ring-offset-background focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90',
'data-[panel-group-direction=horizontal]:hover:cursor-ew-resize data-[panel-group-direction=vertical]:hover:cursor-ns-resize',
]);
}
}
@Directive({
selector: '[hlmResizablePanel],hlm-resizable-panel',
exportAs: 'hlmResizablePanel',
hostDirectives: [
{
directive: BrnResizablePanel,
inputs: ['defaultSize', 'id', 'collapsible', 'maxSize', 'minSize'],
},
],
host: {
'data-slot': 'resizable-panel',
},
})
export class HlmResizablePanel {
private readonly _resizablePanel = inject(BrnResizablePanel);
public setSize(size: number) {
this._resizablePanel.setSize(size);
}
}
export const HlmResizableImports = [HlmResizableGroup, HlmResizablePanel, HlmResizableHandle] as const;import { BrnResizableGroup, BrnResizableHandle, BrnResizablePanel } from '@spartan-ng/brain/resizable';
import { ChangeDetectionStrategy, Component, Directive, inject } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmResizableGroup],hlm-resizable-group',
exportAs: 'hlmResizableGroup',
hostDirectives: [
{
directive: BrnResizableGroup,
inputs: ['direction', 'layout'],
outputs: ['dragEnd', 'dragStart', 'layoutChange'],
},
],
host: {
'data-slot': 'resizable-group',
},
})
export class HlmResizableGroup {
constructor() {
classes(() => 'group flex h-full w-full data-[panel-group-direction=vertical]:flex-col');
}
}
@Component({
selector: 'hlm-resizable-handle',
exportAs: 'hlmResizableHandle',
changeDetection: ChangeDetectionStrategy.OnPush,
hostDirectives: [{ directive: BrnResizableHandle, inputs: ['withHandle', 'disabled'] }],
host: {
'data-slot': 'resizable-handle',
},
template: `
@if (_brnResizableHandle.withHandle()) {
<div class="bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"></div>
}
`,
})
export class HlmResizableHandle {
protected readonly _brnResizableHandle = inject(BrnResizableHandle);
constructor() {
classes(() => [
'bg-border ring-offset-background focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90',
'data-[panel-group-direction=horizontal]:hover:cursor-ew-resize data-[panel-group-direction=vertical]:hover:cursor-ns-resize',
]);
}
}
@Directive({
selector: '[hlmResizablePanel],hlm-resizable-panel',
exportAs: 'hlmResizablePanel',
hostDirectives: [
{
directive: BrnResizablePanel,
inputs: ['defaultSize', 'id', 'collapsible', 'maxSize', 'minSize'],
},
],
host: {
'data-slot': 'resizable-panel',
},
})
export class HlmResizablePanel {
private readonly _resizablePanel = inject(BrnResizablePanel);
public setSize(size: number) {
this._resizablePanel.setSize(size);
}
}
export const HlmResizableImports = [HlmResizableGroup, HlmResizablePanel, HlmResizableHandle] as const;import { BrnResizableGroup, BrnResizableHandle, BrnResizablePanel } from '@spartan-ng/brain/resizable';
import { ChangeDetectionStrategy, Component, Directive, inject } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmResizableGroup],hlm-resizable-group',
exportAs: 'hlmResizableGroup',
hostDirectives: [
{
directive: BrnResizableGroup,
inputs: ['direction', 'layout'],
outputs: ['dragEnd', 'dragStart', 'layoutChange'],
},
],
host: {
'data-slot': 'resizable-group',
},
})
export class HlmResizableGroup {
constructor() {
classes(() => 'group flex h-full w-full data-[panel-group-direction=vertical]:flex-col');
}
}
@Component({
selector: 'hlm-resizable-handle',
exportAs: 'hlmResizableHandle',
changeDetection: ChangeDetectionStrategy.OnPush,
hostDirectives: [{ directive: BrnResizableHandle, inputs: ['withHandle', 'disabled'] }],
host: {
'data-slot': 'resizable-handle',
},
template: `
@if (_brnResizableHandle.withHandle()) {
<div class="bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"></div>
}
`,
})
export class HlmResizableHandle {
protected readonly _brnResizableHandle = inject(BrnResizableHandle);
constructor() {
classes(() => [
'bg-border ring-offset-background focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90',
'data-[panel-group-direction=horizontal]:hover:cursor-ew-resize data-[panel-group-direction=vertical]:hover:cursor-ns-resize',
]);
}
}
@Directive({
selector: '[hlmResizablePanel],hlm-resizable-panel',
exportAs: 'hlmResizablePanel',
hostDirectives: [
{
directive: BrnResizablePanel,
inputs: ['defaultSize', 'id', 'collapsible', 'maxSize', 'minSize'],
},
],
host: {
'data-slot': 'resizable-panel',
},
})
export class HlmResizablePanel {
private readonly _resizablePanel = inject(BrnResizablePanel);
public setSize(size: number) {
this._resizablePanel.setSize(size);
}
}
export const HlmResizableImports = [HlmResizableGroup, HlmResizablePanel, HlmResizableHandle] as const;import { BrnResizableGroup, BrnResizableHandle, BrnResizablePanel } from '@spartan-ng/brain/resizable';
import { ChangeDetectionStrategy, Component, Directive, inject } from '@angular/core';
import { classes } from '@spartan-ng/helm/utils';
@Directive({
selector: '[hlmResizableGroup],hlm-resizable-group',
exportAs: 'hlmResizableGroup',
hostDirectives: [
{
directive: BrnResizableGroup,
inputs: ['direction', 'layout'],
outputs: ['dragEnd', 'dragStart', 'layoutChange'],
},
],
host: {
'data-slot': 'resizable-group',
},
})
export class HlmResizableGroup {
constructor() {
classes(() => 'group flex h-full w-full data-[panel-group-direction=vertical]:flex-col');
}
}
@Component({
selector: 'hlm-resizable-handle',
exportAs: 'hlmResizableHandle',
changeDetection: ChangeDetectionStrategy.OnPush,
hostDirectives: [{ directive: BrnResizableHandle, inputs: ['withHandle', 'disabled'] }],
host: {
'data-slot': 'resizable-handle',
},
template: `
@if (_brnResizableHandle.withHandle()) {
<div class="bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"></div>
}
`,
})
export class HlmResizableHandle {
protected readonly _brnResizableHandle = inject(BrnResizableHandle);
constructor() {
classes(() => [
'bg-border ring-offset-background focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90',
'data-[panel-group-direction=horizontal]:hover:cursor-ew-resize data-[panel-group-direction=vertical]:hover:cursor-ns-resize',
]);
}
}
@Directive({
selector: '[hlmResizablePanel],hlm-resizable-panel',
exportAs: 'hlmResizablePanel',
hostDirectives: [
{
directive: BrnResizablePanel,
inputs: ['defaultSize', 'id', 'collapsible', 'maxSize', 'minSize'],
},
],
host: {
'data-slot': 'resizable-panel',
},
})
export class HlmResizablePanel {
private readonly _resizablePanel = inject(BrnResizablePanel);
public setSize(size: number) {
this._resizablePanel.setSize(size);
}
}
export const HlmResizableImports = [HlmResizableGroup, HlmResizablePanel, HlmResizableHandle] as const;Usage
import { HlmResizableImports } from '@spartan-ng/helm/resizable';<hlm-resizable-group class="h-[200px] w-[500px] max-w-md rounded-lg border">
<hlm-resizable-panel>
<div class="flex h-full items-center justify-center p-6">One</div>
</hlm-resizable-panel>
<hlm-resizable-handle />
<hlm-resizable-panel>
<hlm-resizable-group direction="vertical">
<hlm-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">Two</span>
</div>
</hlm-resizable-panel>
<hlm-resizable-handle />
<hlm-resizable-panel>
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">Three</span>
</div>
</hlm-resizable-panel>
</hlm-resizable-group>
</hlm-resizable-panel>
</hlm-resizable-group>Examples
Vertical
Use the direction prop to set the direction of the resizable panels.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmResizableImports } from '@spartan-ng/helm/resizable';
@Component({
selector: 'spartan-resizable-vertical-preview',
imports: [HlmResizableImports],
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'min-w-xs' },
template: `
<hlm-resizable-group class="min-h-[200px] max-w-sm rounded-lg border" direction="vertical">
<hlm-resizable-panel defaultSize="25">
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">Header</span>
</div>
</hlm-resizable-panel>
<hlm-resizable-handle />
<hlm-resizable-panel defaultSize="75">
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">Content</span>
</div>
</hlm-resizable-panel>
</hlm-resizable-group>
`,
})
export class ResizableVerticalPreview {}Handle
You can set or hide the handle by using the withHandle prop on the hlm-resizable-handle component.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HlmResizableImports } from '@spartan-ng/helm/resizable';
@Component({
selector: 'spartan-resizable-handle-preview',
imports: [HlmResizableImports],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<hlm-resizable-group class="min-h-[200px] max-w-md rounded-lg border md:min-w-[450px]">
<hlm-resizable-panel defaultSize="25">
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">Sidebar</span>
</div>
</hlm-resizable-panel>
<hlm-resizable-handle withHandle />
<hlm-resizable-panel defaultSize="75">
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">Content</span>
</div>
</hlm-resizable-panel>
</hlm-resizable-group>
`,
})
export class ResizableHandlePreview {}Dynamic panels
Panels can be added or removed after the resizable group has rendered.
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { HlmButton } from '@spartan-ng/helm/button';
import { HlmResizableImports } from '@spartan-ng/helm/resizable';
@Component({
selector: 'spartan-resizable-dynamic-preview',
imports: [HlmResizableImports, HlmButton],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="flex flex-col gap-4">
<button hlmBtn class="self-start" variant="outline" (click)="showPanel.update((visible) => !visible)">
{{ showPanel() ? 'Remove panel' : 'Add panel' }}
</button>
<hlm-resizable-group class="min-h-[200px] max-w-md rounded-lg border md:min-w-[450px]" [(layout)]="layout">
<hlm-resizable-panel defaultSize="40">
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">One</span>
</div>
</hlm-resizable-panel>
<hlm-resizable-handle withHandle />
@if (showPanel()) {
<hlm-resizable-panel defaultSize="25">
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">Dynamic</span>
</div>
</hlm-resizable-panel>
<hlm-resizable-handle withHandle />
}
<hlm-resizable-panel defaultSize="60">
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">Two</span>
</div>
</hlm-resizable-panel>
</hlm-resizable-group>
</div>
`,
})
export class ResizableDynamicPreview {
public readonly showPanel = signal(false);
public readonly layout = signal([40, 60]);
}RTL
To enable RTL support in spartan-ng, see the RTL configuration guide.
import { Directionality } from '@angular/cdk/bidi';
import { ChangeDetectionStrategy, Component, computed, effect, inject, untracked } from '@angular/core';
import { TranslateService, Translations } from '@spartan-ng/app/app/shared/translate.service';
import { HlmResizableImports } from '@spartan-ng/helm/resizable';
@Component({
selector: 'spartan-resizable-rtl-preview',
imports: [HlmResizableImports],
providers: [Directionality],
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
class: 'min-w-xs',
'[dir]': '_dir()',
},
template: `
<hlm-resizable-group class="max-w-md rounded-lg border">
<hlm-resizable-panel defaultSize="50">
<div class="flex h-[200px] items-center justify-center p-6">
<span class="font-semibold">{{ _t()['one'] }}</span>
</div>
</hlm-resizable-panel>
<hlm-resizable-handle withHandle />
<hlm-resizable-panel defaultSize="50">
<hlm-resizable-group direction="vertical">
<hlm-resizable-panel defaultSize="25">
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">{{ _t()['two'] }}</span>
</div>
</hlm-resizable-panel>
<hlm-resizable-handle withHandle />
<hlm-resizable-panel defaultSize="75">
<div class="flex h-full items-center justify-center p-6">
<span class="font-semibold">{{ _t()['three'] }}</span>
</div>
</hlm-resizable-panel>
</hlm-resizable-group>
</hlm-resizable-panel>
</hlm-resizable-group>
`,
})
export class ResizableRtlPreview {
private readonly _directionality = inject(Directionality);
private readonly _language = inject(TranslateService).language;
private readonly _translations: Translations = {
en: {
dir: 'ltr',
values: {
one: 'One',
two: 'Two',
three: 'Three',
},
},
ar: {
dir: 'rtl',
values: {
one: 'واحد',
two: 'اثنان',
three: 'ثلاثة',
},
},
he: {
dir: 'rtl',
values: {
one: 'אחד',
two: 'שניים',
three: 'שלושה',
},
},
};
private readonly _translation = computed(() => this._translations[this._language()]);
protected readonly _t = computed(() => this._translation().values);
protected readonly _dir = computed(() => this._translation().dir);
constructor() {
effect(() => {
const dir = this._dir();
untracked(() => this._directionality.valueSignal.set(dir));
});
}
}Brain API
BrnResizableGroup
Selector: brn-resizable-group, [brnResizableGroup]
ExportAs: brnResizableGroup
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | `brn-resizable-group-${++nextId}` | The id of the BrnResizableGroup |
| direction | 'horizontal' | 'vertical' | 'horizontal' | Group orientation |
| layout | number[] | [] | Resize panel group to the specified layout ([1 - 100, ...]). |
Outputs
| Prop | Type | Default | Description |
|---|---|---|---|
| dragStart | void | - | event when resize starts |
| dragEnd | void | - | event when resize ends |
| layoutChanged | number[] | - | Called when group layout changes |
| layoutChange | number[] | [] | Resize panel group to the specified layout ([1 - 100, ...]). |
BrnResizableHandle
Selector: brn-resizable-handle, [brnResizeHandle]
ExportAs: brnResizableHandle
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| withHandle | boolean | false | Whether a visual handle is rendered inside the separator. |
| disabled | boolean | false | Whether the handle is disabled (not interactive). |
BrnResizablePanel
Selector: brn-resizable-panel, [brnResizablePanel]
ExportAs: brnResizablePanel
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | `brn-resizable-panel-${++nextId}` | Unique ID for the panel. |
| defaultSize | number | undefined | The default size of the panel (percentage of container space). - `undefined` → group decides initial size. - Number → interpreted as percentage (0–100). |
| minSize | number | 0 | The minimum size this panel can shrink to (percentage). |
| maxSize | number | 100 | The maximum size this panel can grow to (percentage). |
| collapsible | boolean | true | Whether this panel can be collapsed entirely. |
Helm API
HlmResizableGroup
Selector: [hlmResizableGroup],hlm-resizable-group
ExportAs: hlmResizableGroup
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| direction | 'horizontal' | 'vertical' | 'horizontal' | Group orientation |
| layout | number[] | [] | Resize panel group to the specified layout ([1 - 100, ...]). |
Outputs
| Prop | Type | Default | Description |
|---|---|---|---|
| dragEnd | void | - | event when resize ends |
| dragStart | void | - | event when resize starts |
| layoutChange | number[] | - | Resize panel group to the specified layout ([1 - 100, ...]). |
HlmResizableHandle
Selector: hlm-resizable-handle
ExportAs: hlmResizableHandle
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| withHandle | boolean | false | Whether a visual handle is rendered inside the separator. |
| disabled | boolean | false | Whether the handle is disabled (not interactive). |
HlmResizablePanel
Selector: [hlmResizablePanel],hlm-resizable-panel
ExportAs: hlmResizablePanel
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultSize | number | undefined | The default size of the panel (percentage of container space). - `undefined` → group decides initial size. - Number → interpreted as percentage (0–100). |
| id | string | `brn-resizable-panel-${++nextId}` | Unique ID for the panel. |
| collapsible | boolean | true | Whether this panel can be collapsed entirely. |
| maxSize | number | 100 | The maximum size this panel can grow to (percentage). |
| minSize | number | 0 | The minimum size this panel can shrink to (percentage). |
On This Page