Tableau UI for Angular

Expansion Panel

An expansion panel shows its content when the user opens it; in an accordion, at most one panel is open.

Import

Import TableauUiExpansionPanelModule from tableau-ui-angular/expansion-panel.

Panels

tab-expansion-panel-title is the panel's title; a title marked collapsed or expanded takes its place in that state. A click on the title, or on its arrow button, opens and closes the panel.

  • [(expanded)] binds whether the panel is open, as the checkbox here does for the first one.
  • [disabled] keeps it as it is.
  • [noHeaderHover] turns the title's hover colour off.
  • label names the arrow button in place of the title, as the last panel here does.
  • A button in the title keeps its click from reaching the title, or the click toggles the panel too.
A panel
A disabled panel
A title of its own while closed
The usual title, shown while closed
Closed, with its closed title
A large title with a button, and no hover colour

A second line in the title

import { ChangeDetectionStrategy, Component, inject, signal } from '@angular/core';
import { TableauUiButtonModule } from 'tableau-ui-angular/button';
import { TableauUiCheckboxModule } from 'tableau-ui-angular/checkbox';
import { TableauUiExpansionPanelModule } from 'tableau-ui-angular/expansion-panel';
import { TableauUiIconModule } from 'tableau-ui-angular/icon';
import { SnackService } from 'tableau-ui-angular/snack';

@Component({
  selector: 'app-expansion-panel-single-example',
  imports: [TableauUiButtonModule, TableauUiCheckboxModule, TableauUiExpansionPanelModule, TableauUiIconModule],
  templateUrl: './expansion-panel-single.example.html',
  styleUrl: './expansion-panel-single.example.scss',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ExpansionPanelSingleExampleComponent {
  private readonly snacks = inject(SnackService);

  protected readonly $firstOpen = signal(false);

  // A click in the title toggles the panel: the button keeps its own click from reaching it
  protected run(event: Event) {
    event.stopPropagation();
    this.snacks.openSnack('The button ran, and the panel stayed as it was', 3000, 'info');
  }
}

Accordion

tab-accordion holds panels, and at most one is open: opening a panel closes the others.

Shipping
Gift wrap, not offered for this order
Billing: open it to see the card
Delivery notes
Returns
Order 1024

Shipped on Monday

import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { TableauUiButtonModule } from 'tableau-ui-angular/button';
import { TableauUiExpansionPanelModule } from 'tableau-ui-angular/expansion-panel';
import { TableauUiIconModule } from 'tableau-ui-angular/icon';
import { SnackService } from 'tableau-ui-angular/snack';

@Component({
  selector: 'app-expansion-panel-accordion-example',
  imports: [TableauUiButtonModule, TableauUiExpansionPanelModule, TableauUiIconModule],
  templateUrl: './expansion-panel-accordion.example.html',
  styleUrl: './expansion-panel-accordion.example.scss',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ExpansionPanelAccordionExampleComponent {
  private readonly snacks = inject(SnackService);

  // A click in the title toggles the panel: the button keeps its own click from reaching it
  protected track(event: Event) {
    event.stopPropagation();
    this.snacks.openSnack('Tracking order 1024', 3000, 'info');
  }
}

Accessibility

  • The arrow button opens and closes the panel, from the keyboard too, and its aria-expanded says whether the panel is open.
  • The title names the arrow button, or Details without a title. A title that holds a control, such as a button, or more than the panel's name needs label: without it the button's name is the title's whole text, the control's included, and a search for the control by its name finds the arrow button too.