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.
- 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
Accordion
A vertically stacked set of interactive headings that each reveal a section of content.
Our flagship product combines cutting-edge technology with sleek design. Built with premium materials, it offers unparalleled performance and reliability.
Key features include advanced processing capabilities, and an intuitive user interface designed for both beginners and experts.
We offer worldwide shipping through trusted courier partners. Standard delivery takes 3-5 business days, while express shipping ensures delivery within 1-2 business days.
All orders are carefully packaged and fully insured. Track your shipment in real-time through our dedicated tracking portal.
We stand behind our products with a comprehensive 30-day return policy. If you're not completely satisfied, simply return the item in its original condition.
Our hassle-free return process includes free return shipping and full refunds processed within 48 hours of receiving the returned item.
import { Component } from '@angular/core';
import { NgIcon } from '@ng-icons/core';
import { HlmAccordionImports } from '@spartan-ng/helm/accordion';
import { HlmIconImports } from '@spartan-ng/helm/icon';
@Component({
selector: 'spartan-accordion-preview',
imports: [HlmAccordionImports, NgIcon, HlmIconImports],
host: {
class: 'max-w-lg block h-[250px]',
},
template: `
<hlm-accordion>
<hlm-accordion-item>
<h3 class="contents">
<button hlmAccordionTrigger>
Product Information
<ng-icon name="lucideChevronDown" hlm hlmAccIcon />
</button>
</h3>
<hlm-accordion-content>
<p>
Our flagship product combines cutting-edge technology with sleek design. Built with premium materials, it
offers unparalleled performance and reliability.
</p>
<p>
Key features include advanced processing capabilities, and an intuitive user interface designed for both
beginners and experts.
</p>
</hlm-accordion-content>
</hlm-accordion-item>
<hlm-accordion-item>
<h3 class="contents">
<button hlmAccordionTrigger>
Shipping Details
<ng-icon name="lucideChevronDown" hlm hlmAccIcon />
</button>
</h3>
<hlm-accordion-content>
<p>
We offer worldwide shipping through trusted courier partners. Standard delivery takes 3-5 business days,
while express shipping ensures delivery within 1-2 business days.
</p>
<p>
All orders are carefully packaged and fully insured. Track your shipment in real-time through our dedicated
tracking portal.
</p>
</hlm-accordion-content>
</hlm-accordion-item>
<hlm-accordion-item>
<h3 class="contents">
<button hlmAccordionTrigger>
Return Policy
<ng-icon name="lucideChevronDown" hlm hlmAccIcon />
</button>
</h3>
<hlm-accordion-content>
<p>
We stand behind our products with a comprehensive 30-day return policy. If you're not completely satisfied,
simply return the item in its original condition.
</p>
<p>
Our hassle-free return process includes free return shipping and full refunds processed within 48 hours of
receiving the returned item.
</p>
</hlm-accordion-content>
</hlm-accordion-item>
</hlm-accordion>
`,
})
export class AccordionPreview {}Installation
npx nx g @spartan-ng/cli:ui accordion
ng g @spartan-ng/cli:ui accordion
Usage
import { NgIcon } from '@ng-icons/core';
import { HlmAccordionImports } from '@spartan-ng/helm/accordion';
import { HlmIconImports } from '@spartan-ng/helm/icon';<hlm-accordion>
<hlm-accordion-item>
<h3 class='contents'>
<button hlmAccordionTrigger>
Is it accessible?
<ng-icon name="lucideChevronDown" hlm hlmAccIcon />
</button>
</h3>
<hlm-accordion-content>Yes. It adheres to the WAI-ARIA design pattern.</hlm-accordion-content>
</hlm-accordion-item>
</hlm-accordion>Examples
Multiple and Opened
The type input can be set to 'multiple' to allow multiple items to be opened at the same time.
The isOpened input can be used to set the initial state of an accordion item.
import { Component, signal } from '@angular/core';
import { NgIcon } from '@ng-icons/core';
import { HlmAccordionImports } from '@spartan-ng/helm/accordion';
import { HlmButtonImports } from '@spartan-ng/helm/button';
import { HlmIconImports } from '@spartan-ng/helm/icon';
@Component({
selector: 'spartan-accordion-multiple-opened',
imports: [HlmButtonImports, HlmAccordionImports, HlmIconImports, NgIcon],
host: {
class: 'max-w-lg h-[320px] flex flex-col justify-between',
},
template: `
<hlm-accordion type="multiple" class="pb-4">
<hlm-accordion-item [isOpened]="true">
<h3 class="contents">
<button hlmAccordionTrigger>
Is it accessible?
<ng-icon name="lucideChevronDown" hlm hlmAccIcon />
</button>
</h3>
<hlm-accordion-content>Yes. It adheres to the WAI-ARIA design pattern.</hlm-accordion-content>
</hlm-accordion-item>
<hlm-accordion-item>
<h3 class="contents">
<button hlmAccordionTrigger>
Is it styled?
<ng-icon name="lucideChevronDown" hlm hlmAccIcon />
</button>
</h3>
<hlm-accordion-content>
Yes. It comes with default styles that match the other components' aesthetics.
</hlm-accordion-content>
</hlm-accordion-item>
<hlm-accordion-item (openedChange)="_thirdOpened.set($event)" [isOpened]="_thirdOpened()">
<h3 class="contents">
<button hlmAccordionTrigger>
Is it animated?
<ng-icon name="lucideChevronDown" hlm hlmAccIcon />
</button>
</h3>
<hlm-accordion-content>
Yes. It's animated by default, but you can disable it if you prefer.
</hlm-accordion-content>
</hlm-accordion-item>
</hlm-accordion>
<button hlmBtn class="w-fit" (click)="toggleThird()">Toggle Third Item</button>
`,
})
export class AccordionMultipleOpened {
protected readonly _thirdOpened = signal(false);
toggleThird() {
this._thirdOpened.set(!this._thirdOpened());
}
}Brain API
BrnAccordionContent
Selector: brn-accordion-content,[brnAccordionContent]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| style | string | overflow: hidden | The style to be applied to the host element after the dimensions are calculated. |
| styleWhileDimensionsAreInitiating | string | overflow: hidden | The style to be applied to the host element while the dimensions are being calculated. |
BrnAccordionItem
Selector: [brnAccordionItem]
ExportAs: brnAccordionItem
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| isOpened | boolean | false | Whether the item is opened or closed. |
Outputs
| Prop | Type | Default | Description |
|---|---|---|---|
| stateChange | 'open' | 'closed' | - | Emits boolean when the item is opened or closed. |
| openedChange | boolean | - | Emits state change when item is opened or closed |
BrnAccordionTrigger
Selector: [brnAccordionTrigger]
BrnAccordion
Selector: [brnAccordion]
ExportAs: brnAccordion
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| type | 'single' | 'multiple' | single | Whether the accordion is in single or multiple mode. |
| dir | 'ltr' | 'rtl' | null | null | The direction of the accordion, either 'ltr' (left-to-right) or 'rtl' (right-to-left). |
| orientation | 'horizontal' | 'vertical' | vertical | The orientation of the accordion, either 'horizontal' or 'vertical'. |
Helm API
HlmAccordionContent
Selector: hlm-accordion-content
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmAccordionIcon
Selector: ng-icon[hlmAccordionIcon], ng-icon[hlmAccIcon]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmAccordionItem
Selector: [hlmAccordionItem],brn-accordion-item[hlm],hlm-accordion-item
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmAccordionTrigger
Selector: [hlmAccordionTrigger]
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |
HlmAccordion
Selector: [hlmAccordion], hlm-accordion
Inputs
| Prop | Type | Default | Description |
|---|---|---|---|
| class | ClassValue | - | - |