Adaptable

#Building Blocks

The package exports buttons, selects, checkboxes and other controls with the Adaptable look, for toolbars and panels that sit next to the grid. They are standalone components, exported by name: list them in the imports of your component (the components object holds the same classes, but a template can only use a class it imports by name). They need an <adaptable-provider> ancestor.

For the parts of the grid itself (the dashboard, the view picker, the settings panel and its pages), see UI.

Importing the building blocks
import { Button, Select } from '@adaptabletools/datagrid-angular';

@Component({
  selector: 'app-toolbar',
  imports: [Button, Select],
  template: `
    <adaptable-select size="small" [options]="options" [(value)]="size" />
    <button adaptableButton variant="outlined" (click)="apply()">Apply</button>
  `,
})
export class AppToolbar {
  protected readonly options = [
    { label: 'Compact', value: 'compact' },
    { label: 'Comfortable', value: 'comfortable' },
  ];
  protected readonly size = signal('compact');

  protected apply() {
    // …
  }
}

Each goes on the element it renders:

  • Button — <button adaptableButton>: variant ('text' | 'outlined' | 'contained'), tone, size ('small' | 'medium' | 'large'), icon, … and the button's own (click). A tooltip is the *adtTooltip of the button.
  • Select — <adaptable-select>, a dropdown; see below.
  • CheckBox — <label adaptableCheckBox [(checked)]="done">Done</label>.
  • Icon — <svg adaptableIcon name="…">.
  • Logo — <div adaptableLogo>.
  • Layout — <div adaptableLayout>, a flex container.

The SelectProps and ButtonProps types are exported too.

#Using the Select component

Select needs three props:

  • options — { label, value, disabled? }[]. Options can also be grouped ({ label, options }) or separated with 'separator'.
  • value — the selected value.
  • onChange(value) — called when the user picks an option.

In Angular, onChange is the output (valueChange), so [(value)] binds the value both ways.

Optional props include size ('small' | 'medium'), placeholder, disabled, label, className and style.

#
A view switcher built with Select and Button

Select lists the views and Button moves to the next one. Both read and write the current view through injectViews() (the counterpart of the useViews hook), called in a component rendered inside <adaptable-provider>, so they stay in sync with the Adaptable state.

open
loading demo…