# Theming

> Read our docs on the available themes and how you can customize the look and feel of InfiniteTable for Angular.

Canonical page: https://infinite-table.com/angular/docs/learn/theming/

`<infinite-table />` ships with a CSS file that you need to add to the global styles of your application to make the component look as intended - import it at the top of `src/styles.css`, or list it in the `styles` of the build options in `angular.json`:

```css title="src/styles.css"
@import '@infinite-table/infinite-angular/index.css';
```

This root CSS file includes the `"default"` theme.

The other available themes are

  - `shadcn`
  - `minimalist`
  - `ocean`
  - `balsam`
  - `terminal`
  - `sheet`
  - `paper`

and if you want to use any of them, you have to import their respective CSS file explicitly:

```css title="src/styles.css"
@import '@infinite-table/infinite-angular/theme/shadcn.css';
@import '@infinite-table/infinite-angular/theme/balsam.css';
@import '@infinite-table/infinite-angular/theme/minimalist.css';
@import '@infinite-table/infinite-angular/theme/ocean.css';
@import '@infinite-table/infinite-angular/theme/terminal.css';
@import '@infinite-table/infinite-angular/theme/sheet.css';
@import '@infinite-table/infinite-angular/theme/paper.css';
```

Each theme CSS file includes both the **`light`** and the **`dark`** modes.

Splitting each theme into a dedicated CSS file helps reduce the bundle size for our users, as most people will only use one theme for `<InfiniteTable />` in their apps.

## Applying a theme

The following themes are currently available:

 - `default` - applied by default, no special configuration needed. It's included in the root CSS you need to import from `@infinite-table/infinite-angular/index.css`
 - `balsam`
 - `minimalist`
 - `ocean`
 - `terminal`
 - `sheet`
 - `paper`
 - `shadcn` - for this theme to correctly show up, make sure the shadcn CSS vars are available on page - see [shadcn theming](https://ui.shadcn.com/docs/theming) for details

To apply a theme (except the default one), you have to set the className `"infinite-theme-name--THEME_NAME"` to any parent element of the `<InfiniteTable />` component (or even on the component itself).

You will want to apply the theme name and theme mode classNames to the same element, so you'll end up with a className like `"infinite-theme-name--minimalist infinite-theme-mode--dark"`.

```ts
// the root component of the application: the classes on its host element
// apply to every grid in the application
@Component({
  selector: 'app-root',
  imports: [DataSource, InfiniteTable],
  host: { class: 'infinite-theme-mode--dark infinite-theme-name--minimalist' },
  template: `
    <infinite-data-source [data]="data" primaryKey="id">
      <infinite-table [columns]="columns" />
    </infinite-data-source>
  `,
})
export class MinimalistDarkApp {
  protected readonly data = data;
  protected readonly columns = columns;
}
```

Example configured with `minimalist` theme and `dark` mode by default.

**Example: Theme switching demo - defaults to minimalist theme in dark mode**

```ts
import { Component, ViewEncapsulation, computed, signal } from '@angular/core';

import { DataSource, InfiniteTable } from '@infinite-table/infinite-angular';

import { columns } from './columns.angular';
import type { Employee } from './columns.angular';

type ThemeName = 'default' | 'minimalist' | 'ocean' | 'balsam' | 'shadcn';

const dataSource = () => {
  return fetch(process.env.NEXT_PUBLIC_BASE_URL + '/employees100')
    .then((r) => r.json())
    .then((data: Employee[]) => {
      console.log(data);
      return data;
    });
};

@Component({
  selector: 'demo-root',
  imports: [DataSource, InfiniteTable],
  // global styles: an Angular application lists the theme CSS files (and the
  // shadcn variables) in the global styles, not in a component
  encapsulation: ViewEncapsulation.None,
  styles: `
    /* the shadcn CSS variables the shadcn theme reads (shadcn-ui-css-vars) */
    :root {
      --background: oklch(1 0 0);
      --foreground: oklch(0.145 0 0);
      --popover-foreground: oklch(0.145 0 0);
      --primary: oklch(0.205 0 0);
      --muted: oklch(0.97 0 0);
      --muted-foreground: oklch(0.556 0 0);
      --accent: oklch(0.97 0 0);
      --destructive: oklch(0.577 0.245 27.325);
      --border: oklch(0.922 0 0);
      --input: oklch(0.922 0 0);
    }
    .dark {
      --background: oklch(0.145 0 0);
      --foreground: oklch(0.985 0 0);
      --popover-foreground: oklch(0.985 0 0);
      --primary: oklch(0.985 0 0);
      --muted: oklch(0.269 0 0);
      --muted-foreground: oklch(0.708 0 0);
      --accent: oklch(0.269 0 0);
      --destructive: oklch(0.396 0.141 25.723);
      --border: oklch(0.269 0 0);
      --input: oklch(0.269 0 0);
    }
  `,
  template: `
    
    <div
      [class]="themeClassName()"
      style="display: flex; flex-flow: column; flex: 1; color: var(--infinite-cell-color); background: var(--infinite-background)"
    >
      <infinite-data-source [data]="dataSource" primaryKey="id">
        <infinite-table debugId="theme-switching-minimalist-theme-default-example" [columns]="columns" />
      </infinite-data-source>

      <div style="margin: 10px">
        Current settings: <b>{{ currentThemeName() }}</b> theme,
        <b>{{ currentThemeMode() }}</b> mode.
      </div>
      <div
        style="display: flex; flex-flow: row; align-items: center; gap: 10px; padding: 10px"
      >
        Select theme
        <select
          title="Select theme"
          [value]="currentThemeName()"
          (change)="setThemeName($event)"
        >
          <option value="shadcn">Shadcn</option>
          <option value="ocean">Ocean</option>
          <option value="balsam">Balsam</option>
          <option value="minimalist">Minimalist</option>
          <option value="default">Default</option>
        </select>
        <button (click)="toggleThemeMode()">
          Switch to {{ currentThemeMode() === 'dark' ? 'light' : 'dark' }} mode.
        </button>
      </div>
    </div>
  `,
})
export default class App {
  protected readonly dataSource = dataSource;
  protected readonly columns = columns;

  protected readonly currentThemeMode = signal<'light' | 'dark'>('dark');
  protected readonly currentThemeName = signal<ThemeName>('minimalist');

  protected readonly themeClassName = computed(() => {
    const mode = this.currentThemeMode();
    const name = this.currentThemeName();
    return `infinite-theme-mode--${mode} infinite-theme-name--${name} ${
      name === 'shadcn' && mode === 'dark' ? 'dark' : ''
    }`;
  });

  protected setThemeName(event: Event) {
    this.currentThemeName.set(
      (event.target as HTMLSelectElement).value as ThemeName,
    );
  }

  protected toggleThemeMode() {
    this.currentThemeMode.set(
      this.currentThemeMode() === 'dark' ? 'light' : 'dark',
    );
  }
}
```

## Theme mode - light or dark

At runtime, the `light` or `dark` mode is applied based on the user OS settings for the [preferred color scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme).

To explicitly apply the light mode, apply the className `"infinite-theme-mode--light"` to any parent element of the `<InfiniteTable />` component.

To explicitly apply the dark mode, apply the className `"infinite-theme-mode--dark"` to any parent element of the `<InfiniteTable />` component.

```ts
<div class="infinite-theme-mode--light">
  <infinite-data-source [data]="data" primaryKey="id">
    <infinite-table [columns]="columns" />
  </infinite-data-source>
</div>
```

If instead you specify a `infinite-theme-mode--dark` CSS className, the dark mode will be applied

```ts
@Component({
  selector: 'app-root',
  imports: [DataSource, InfiniteTable],
  host: { class: 'infinite-theme-mode--dark' },
  template: `
    <div>
      <infinite-data-source [data]="data" primaryKey="id">
        <infinite-table [columns]="columns" />
      </infinite-data-source>
    </div>
  `,
})
export class DarkApp {
  protected readonly data = data;
  protected readonly columns = columns;
}
```

Example configured with `default` theme and `light` mode by default.

**Example: Theme switching demo - defaults to light theme**

```ts
import { Component, ViewEncapsulation, computed, signal } from '@angular/core';

import { DataSource, InfiniteTable } from '@infinite-table/infinite-angular';

import { columns } from './columns.angular';
import type { Employee } from './columns.angular';

type ThemeName = 'default' | 'minimalist' | 'ocean' | 'balsam' | 'shadcn';

const dataSource = () => {
  return fetch(process.env.NEXT_PUBLIC_BASE_URL + '/employees100')
    .then((r) => r.json())
    .then((data: Employee[]) => {
      console.log(data);
      return data;
    });
};

@Component({
  selector: 'demo-root',
  imports: [DataSource, InfiniteTable],
  // global styles: an Angular application lists the theme CSS files (and the
  // shadcn variables) in the global styles, not in a component
  encapsulation: ViewEncapsulation.None,
  styles: `
    /* the shadcn CSS variables the shadcn theme reads (shadcn-ui-css-vars) */
    :root {
      --background: oklch(1 0 0);
      --foreground: oklch(0.145 0 0);
      --popover-foreground: oklch(0.145 0 0);
      --primary: oklch(0.205 0 0);
      --muted: oklch(0.97 0 0);
      --muted-foreground: oklch(0.556 0 0);
      --accent: oklch(0.97 0 0);
      --destructive: oklch(0.577 0.245 27.325);
      --border: oklch(0.922 0 0);
      --input: oklch(0.922 0 0);
    }
    .dark {
      --background: oklch(0.145 0 0);
      --foreground: oklch(0.985 0 0);
      --popover-foreground: oklch(0.985 0 0);
      --primary: oklch(0.985 0 0);
      --muted: oklch(0.269 0 0);
      --muted-foreground: oklch(0.708 0 0);
      --accent: oklch(0.269 0 0);
      --destructive: oklch(0.396 0.141 25.723);
      --border: oklch(0.269 0 0);
      --input: oklch(0.269 0 0);
    }
  `,
  template: `
    
    <div
      [class]="themeClassName()"
      style="display: flex; flex-flow: column; flex: 1; color: var(--infinite-cell-color); background: var(--infinite-background)"
    >
      <infinite-data-source [data]="dataSource" primaryKey="id">
        <infinite-table debugId="theme-switching-example" [columns]="columns" />
      </infinite-data-source>

      <div style="margin: 10px">
        Current settings: <b>{{ currentThemeName() }}</b> theme,
        <b>{{ currentThemeMode() }}</b> mode.
      </div>
      <div
        style="display: flex; flex-flow: row; align-items: center; gap: 10px; padding: 10px"
      >
        Select theme
        <select
          title="Select theme"
          [value]="currentThemeName()"
          (change)="setThemeName($event)"
        >
          <option value="shadcn">Shadcn</option>
          <option value="ocean">Ocean</option>
          <option value="balsam">Balsam</option>
          <option value="minimalist">Minimalist</option>
          <option value="default">Default</option>
        </select>
        <button (click)="toggleThemeMode()">
          Switch to {{ currentThemeMode() === 'dark' ? 'light' : 'dark' }} mode.
        </button>
      </div>
    </div>
  `,
})
export default class App {
  protected readonly dataSource = dataSource;
  protected readonly columns = columns;

  protected readonly currentThemeMode = signal<'light' | 'dark'>('light');
  protected readonly currentThemeName = signal<ThemeName>('default');

  protected readonly themeClassName = computed(() => {
    const mode = this.currentThemeMode();
    const name = this.currentThemeName();
    return `infinite-theme-mode--${mode} infinite-theme-name--${name} ${
      name === 'shadcn' && mode === 'dark' ? 'dark' : ''
    }`;
  });

  protected setThemeName(event: Event) {
    this.currentThemeName.set(
      (event.target as HTMLSelectElement).value as ThemeName,
    );
  }

  protected toggleThemeMode() {
    this.currentThemeMode.set(
      this.currentThemeMode() === 'dark' ? 'light' : 'dark',
    );
  }
}
```

If you don't explicitly have a `infinite-theme-mode--light` or `infinite-theme-mode--dark` ancestor, `InfiniteTable` will use the browser/OS preference (via `@media (prefers-color-scheme: ...)`) to apply the dark or light theme.

## Density

Density is independent of the theme, and works with any of them. Apply one of the following classNames to the `<InfiniteTable />` component, or to any of its parent elements:

- `infinite-density--compact`
- `infinite-density--comfortable` - the default
- `infinite-density--spacious`

```ts
<div class="infinite-theme-name--minimalist infinite-density--compact">
  <infinite-data-source [data]="data" primaryKey="id">
    <infinite-table [columns]="columns" />
  </infinite-data-source>
</div>
```

The density scales the sizes defined by the theme: the row height, the column header height, the cell and header cell paddings, the spacing of the menu items (column menu, context menus, filter operator menu), of the column filter editors and of the grouping toolbar items, and (slightly) the font size. Since it's relative to the theme, a dense theme with the `compact` density is denser still.

The density changes the row height and the column header height only when you don't specify the [`rowHeight`](https://infinite-table.com/angular/docs/reference/infinite-table-props.md#rowHeight) and [`columnHeaderHeight`](https://infinite-table.com/angular/docs/reference/infinite-table-props.md#columnHeaderHeight) props - in this case, they come from the `--infinite-row-height` and `--infinite-column-header-height` CSS variables of the theme, multiplied by the density.

Similarly, if you specify `--infinite-cell-padding` (or `--infinite-header-cell-padding`), it's used as is. To have the paddings scaled by the density, specify `--infinite-cell-padding-x` and `--infinite-cell-padding-y` instead.

The spacings that can be specified as shorthands with multiple values (`--infinite-menu-padding`, `--infinite-grouping-toolbar-padding` and `--infinite-grouping-toolbar-gap`) are not scaled by the density - they're left to the theme.

Under the hood, the density classNames set the `--infinite-density-scale` CSS variable - `0.8` for `compact`, `1` for `comfortable` and `1.2` for `spacious`. You can also set it to any other value.

```css title="A custom density"
.my-app {
  --infinite-density-scale: 0.9;
}
```

**Example: Changing the density**

```ts
import { Component, signal } from '@angular/core';

import {
  DataSource,
  GroupRowsState,
  InfiniteTable,
} from '@infinite-table/infinite-angular';
import type { DataSourcePropGroupBy } from '@infinite-table/infinite-angular';

import { columns } from './columns.angular';
import type { Employee } from './columns.angular';

type Density = 'compact' | 'comfortable' | 'spacious';

const groupRowsState = new GroupRowsState({
  expandedRows: true,
  collapsedRows: [],
});

const groupBy: DataSourcePropGroupBy<Employee> = [{ field: 'department' }];

const dataSource = () => {
  return fetch(process.env.NEXT_PUBLIC_BASE_URL + '/employees100').then((r) =>
    r.json(),
  );
};

@Component({
  selector: 'demo-root',
  imports: [DataSource, InfiniteTable],
  template: `
    
    <div
      [class]="'infinite-density--' + density()"
      style="display: flex; flex-flow: column; flex: 1; color: var(--infinite-cell-color); background: var(--infinite-background)"
    >
      <div
        style="display: flex; flex-flow: row; align-items: center; gap: 10px; padding: 10px"
      >
        Density
        <select
          title="Select density"
          [value]="density()"
          (change)="setDensity($event)"
        >
          <option value="compact">compact</option>
          <option value="comfortable">comfortable</option>
          <option value="spacious">spacious</option>
        </select>
      </div>
      <infinite-data-source
        [data]="dataSource"
        primaryKey="id"
        [groupBy]="groupBy"
        [defaultGroupRowsState]="groupRowsState"
      >
        <!-- no rowHeight specified, so the density drives it -->
        <infinite-table debugId="density-example" [columns]="columns" />
      </infinite-data-source>
    </div>
  `,
})
export default class App {
  protected readonly dataSource = dataSource;
  protected readonly columns = columns;
  protected readonly groupBy = groupBy;
  protected readonly groupRowsState = groupRowsState;

  protected readonly density = signal<Density>('compact');

  protected setDensity(event: Event) {
    this.density.set((event.target as HTMLSelectElement).value as Density);
  }
}
```

## Icons

The icons of `<InfiniteTable />` can be replaced via CSS - every icon has a CSS variable that you can set to an image, typically an SVG data URI.

```css title="Replacing the expand/collapse icon"
.my-app {
  --infinite-icon-expand-collapse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E");
}
```

The image is used as a mask, so only its shape matters (its colors don't) - the icon is painted with the current text color (the expand/collapse icon uses `--infinite-expand-collapse-icon-color` and the loading icon uses the accent color).

The available icon variables are:

| CSS variable | Icon |
| --- | --- |
| `--infinite-icon-expand-collapse` | expand/collapse icon of group rows, tree nodes and row details - should point to the end (right), it's rotated when expanded |
| `--infinite-icon-loading` | loading icon - it's rotated by a CSS animation |
| `--infinite-icon-sort-asc` | sort ascending icon, in column headers |
| `--infinite-icon-sort-desc` | sort descending icon, in column headers |
| `--infinite-icon-filter` | the icon displayed in the header of filtered columns |
| `--infinite-icon-menu` | the column menu icon, in column headers |
| `--infinite-icon-done` | the icon for the selected filter operator, in the filter operator menu |
| `--infinite-icon-clear` | the icon for clearing the filter, and for removing a group in the grouping toolbar |
| `--infinite-icon-hidden` | the icon displayed when dragging a column outside the table, to hide it |
| `--infinite-icon-filter-operator-contains`, `-starts-with`, `-ends-with`, `-eq`, `-neq`, `-gt`, `-gte`, `-lt`, `-lte` | the filter operator icons |

When the variables are not specified, the default icons are rendered (as inline SVG). The variables work the same way in React, Vue and Angular.

**Example: Replacing the icons via CSS variables**

```ts
import { Component } from '@angular/core';

import { DataSource, InfiniteTable } from '@infinite-table/infinite-angular';
import type {
  CSSProperties,
  DataSourcePropGroupBy,
  DataSourcePropSortInfo,
} from '@infinite-table/infinite-angular';

import { columns } from './columns.angular';
import type { Employee } from './columns.angular';

// any image can be used as an icon - it's used as a mask, painted with the
// text color (or the icon color, for the expand/collapse icon)
const svgIcon = (paths: string) =>
  `url("data:image/svg+xml,${encodeURIComponent(
    `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${paths}</svg>`,
  )}")`;

const iconVars: CSSProperties = {
  '--infinite-icon-expand-collapse': svgIcon('<path d="M9 6l6 6-6 6"/>'),
  '--infinite-icon-sort-asc': svgIcon('<path d="M12 19V5M5 12l7-7 7 7"/>'),
  '--infinite-icon-sort-desc': svgIcon('<path d="M12 5v14M19 12l-7 7-7-7"/>'),
  '--infinite-icon-menu': svgIcon(
    '<circle cx="5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/>',
  ),
};

const groupBy: DataSourcePropGroupBy<Employee> = [{ field: 'department' }];
const defaultSortInfo: DataSourcePropSortInfo<Employee> = [
  { field: 'salary', dir: -1 },
];

const dataSource = () => {
  return fetch(process.env.NEXT_PUBLIC_BASE_URL + '/employees100').then((r) =>
    r.json(),
  );
};

@Component({
  selector: 'demo-root',
  imports: [DataSource, InfiniteTable],
  template: `
    <infinite-data-source
      [data]="dataSource"
      primaryKey="id"
      [groupBy]="groupBy"
      [defaultSortInfo]="defaultSortInfo"
    >
      <infinite-table
        debugId="custom-icons-example"
        [domProps]="domProps"
        [columns]="columns"
      />
    </infinite-data-source>
  `,
})
export default class App {
  protected readonly dataSource = dataSource;
  protected readonly columns = columns;
  protected readonly groupBy = groupBy;
  protected readonly defaultSortInfo = defaultSortInfo;
  protected readonly domProps = { style: iconVars };
}
```

You can also replace the icons with your own components - see [`columns.renderSortIcon`](https://infinite-table.com/angular/docs/reference/infinite-table-props.md#columns.renderSortIcon), [`columns.renderMenuIcon`](https://infinite-table.com/angular/docs/reference/infinite-table-props.md#columns.renderMenuIcon), [`columns.renderGroupIcon`](https://infinite-table.com/angular/docs/reference/infinite-table-props.md#columns.renderGroupIcon) and [`columns.renderTreeIcon`](https://infinite-table.com/angular/docs/reference/infinite-table-props.md#columns.renderTreeIcon).

## Available themes

### Default theme

The `default` theme is applied when you don't specify any explicit theme by default.

### Minimalist theme

The `minimalist` theme is inspired from minimalistic designs and is a good choice if you want to keep the UI simple and clean.

### Terminal theme

The `terminal` theme is made for dense, data-heavy screens, like trading desks: a monospace font with tabular numbers (so numbers line up), compact rows, hairline dividers and green/red flashing for values going up/down. It's designed dark-first, but it has a light mode too.

```css title="src/styles.css"
@import '@infinite-table/infinite-angular/theme/terminal.css';
```

```ts
<div class="infinite-theme-name--terminal infinite-theme-mode--dark">
  <infinite-data-source [data]="data" primaryKey="id">
    <infinite-table [columns]="columns" />
  </infinite-data-source>
</div>
```

It works with the density classNames - since the theme is already dense, `infinite-density--compact` makes it even denser.

**Example: Terminal theme, with flashing cells**

```ts
import { Component, effect, signal } from '@angular/core';

import {
  DataSource,
  InfiniteTable,
  createFlashingColumnCellComponent,
} from '@infinite-table/infinite-angular';
import type {
  DataSourceApi,
  InfiniteTablePropColumns,
} from '@infinite-table/infinite-angular';

type Quote = {
  id: number;
  symbol: string;
  sector: string;
  price: number;
  change: number;
  volume: number;
};

const SECTORS = ['Technology', 'Energy', 'Financials', 'Healthcare'];

const data: Quote[] = Array.from({ length: 40 }, (_, i) => ({
  id: i,
  symbol: `SYM${String(i).padStart(2, '0')}`,
  sector: SECTORS[i % SECTORS.length],
  price: 50 + ((i * 37) % 400),
  change: 0,
  volume: (i * 7919) % 900_000,
}));

const FlashingCell = createFlashingColumnCellComponent({
  flashDuration: 800,
});

const format = (value: number) =>
  value.toLocaleString('en-US', {
    minimumFractionDigits: 2,
    maximumFractionDigits: 2,
  });

const columns: InfiniteTablePropColumns<Quote> = {
  symbol: { field: 'symbol', header: 'Symbol' },
  sector: { field: 'sector', header: 'Sector' },
  price: {
    field: 'price',
    header: 'Price',
    type: 'number',
    renderValue: ({ value }) => format(value),
    components: { ColumnCell: FlashingCell },
  },
  change: {
    field: 'change',
    header: 'Chg',
    type: 'number',
    renderValue: ({ value }) => format(value),
    style: ({ value }) => ({
      color:
        value > 0
          ? 'var(--infinite-success-color)'
          : value < 0
          ? 'var(--infinite-error-color)'
          : undefined,
    }),
  },
  volume: { field: 'volume', header: 'Volume', type: 'number' },
};

@Component({
  selector: 'demo-root',
  imports: [DataSource, InfiniteTable],
  template: `
    <div
      class="infinite-theme-name--terminal infinite-theme-mode--dark"
      style="display: flex; flex: 1"
    >
      <infinite-data-source
        [data]="data"
        primaryKey="id"
        (ready)="api.set($event)"
      >
        <infinite-table [columns]="columns" [columnDefaultWidth]="130" />
      </infinite-data-source>
    </div>
  `,
})
export default class App {
  protected readonly data = data;
  protected readonly columns = columns;

  protected readonly api = signal<DataSourceApi<Quote> | null>(null);

  constructor() {
    effect((onCleanup) => {
      const api = this.api();
      if (!api) {
        return;
      }
      const interval = setInterval(() => {
        const quote = data[Math.floor(Math.random() * data.length)];
        const delta = Math.round((Math.random() - 0.5) * quote.price) / 100;
        quote.price = Math.max(
          1,
          Math.round((quote.price + delta) * 100) / 100,
        );
        quote.change = Math.round((quote.change + delta) * 100) / 100;
        api.updateData({
          id: quote.id,
          price: quote.price,
          change: quote.change,
        });
      }, 150);
      onCleanup(() => clearInterval(interval));
    });
  }
}
```

### Sheet theme

The `sheet` theme looks like a spreadsheet: full gridlines, sharp corners, an active cell with a thick border and a fill handle, and a header that looks like the column headers of a spreadsheet. It has a light and a dark mode.

```css title="src/styles.css"
@import '@infinite-table/infinite-angular/theme/sheet.css';
```

The first column pinned at the start (see [`[(columnPinning)]`](https://infinite-table.com/angular/docs/reference/infinite-table-props.md#columnPinning)) is styled like the row headers of a spreadsheet - so if you want row numbers, add a column that renders `rowInfo.indexInAll + 1` and pin it at the start.

**Example: Sheet theme, with a row number column**

```ts
import { Component } from '@angular/core';

import { DataSource, InfiniteTable } from '@infinite-table/infinite-angular';
import type {
  InfiniteTablePropColumnPinning,
  InfiniteTablePropColumns,
} from '@infinite-table/infinite-angular';

type Row = { id: number; region: string; q1: number; q2: number; q3: number };

const REGIONS = ['North', 'South', 'East', 'West', 'Central'];

const data: Row[] = Array.from({ length: 30 }, (_, i) => ({
  id: i,
  region: REGIONS[i % REGIONS.length],
  q1: 1000 + ((i * 337) % 900),
  q2: 1000 + ((i * 511) % 900),
  q3: 1000 + ((i * 719) % 900),
}));

const columns: InfiniteTablePropColumns<Row> = {
  // a pinned row number column - styled like the row headers of a spreadsheet
  rowNumber: {
    header: '',
    defaultWidth: 50,
    align: 'center',
    renderValue: ({ rowInfo }) => rowInfo.indexInAll + 1,
  },
  region: { field: 'region', header: 'Region' },
  q1: { field: 'q1', header: 'Q1', type: 'number' },
  q2: { field: 'q2', header: 'Q2', type: 'number' },
  q3: { field: 'q3', header: 'Q3', type: 'number' },
};

const defaultColumnPinning: InfiniteTablePropColumnPinning = {
  rowNumber: 'start',
};

@Component({
  selector: 'demo-root',
  imports: [DataSource, InfiniteTable],
  template: `
    <div class="infinite-theme-name--sheet" style="display: flex; flex: 1">
      <infinite-data-source [data]="data" primaryKey="id">
        <infinite-table
          [columns]="columns"
          [defaultColumnPinning]="defaultColumnPinning"
          keyboardNavigation="cell"
          [defaultActiveCellIndex]="defaultActiveCellIndex"
        />
      </infinite-data-source>
    </div>
  `,
})
export default class App {
  protected readonly data = data;
  protected readonly columns = columns;
  protected readonly defaultColumnPinning = defaultColumnPinning;
  protected readonly defaultActiveCellIndex: [number, number] = [2, 2];
}
```

### Paper theme

The `paper` theme is borderless and airy: hairline row separators, a subtle hover, selected rows painted as rounded pills, and its own icon set (rounded strokes) - a good fit for document-like and productivity apps. It has a light and a dark mode.

```css title="src/styles.css"
@import '@infinite-table/infinite-angular/theme/paper.css';
```

Its icons are set via the `--infinite-icon-*` CSS variables (see [Icons](#icons)), so you can replace any of them, or reuse them with another theme.

**Example: Paper theme, with selected rows**

```ts
import { Component } from '@angular/core';

import { DataSource, InfiniteTable } from '@infinite-table/infinite-angular';
import type {
  DataSourcePropGroupBy,
  DataSourcePropRowSelection,
  DataSourcePropSortInfo,
  InfiniteTablePropColumns,
} from '@infinite-table/infinite-angular';

type Task = {
  id: number;
  title: string;
  status: string;
  owner: string;
  estimate: number;
};

const STATUSES = ['Backlog', 'In progress', 'Done'];
const OWNERS = ['Ana', 'Ben', 'Chloe', 'Dan'];

const data: Task[] = Array.from({ length: 24 }, (_, i) => ({
  id: i,
  title: `Task ${i + 1}`,
  status: STATUSES[i % STATUSES.length],
  owner: OWNERS[i % OWNERS.length],
  estimate: ((i * 3) % 8) + 1,
}));

const columns: InfiniteTablePropColumns<Task> = {
  title: { field: 'title', header: 'Title', defaultFlex: 1 },
  owner: { field: 'owner', header: 'Owner' },
  estimate: { field: 'estimate', header: 'Estimate', type: 'number' },
};

const groupBy: DataSourcePropGroupBy<Task> = [{ field: 'status' }];
const defaultRowSelection: DataSourcePropRowSelection = {
  selectedRows: [1, 4],
  defaultSelection: false,
};
const defaultSortInfo: DataSourcePropSortInfo<Task> = [
  { field: 'estimate', dir: -1 },
];

@Component({
  selector: 'demo-root',
  imports: [DataSource, InfiniteTable],
  template: `
    <div class="infinite-theme-name--paper" style="display: flex; flex: 1">
      <infinite-data-source
        [data]="data"
        primaryKey="id"
        [groupBy]="groupBy"
        selectionMode="multi-row"
        [defaultRowSelection]="defaultRowSelection"
        [defaultSortInfo]="defaultSortInfo"
      >
        <infinite-table [columns]="columns" />
      </infinite-data-source>
    </div>
  `,
})
export default class App {
  protected readonly data = data;
  protected readonly columns = columns;
  protected readonly groupBy = groupBy;
  protected readonly defaultRowSelection = defaultRowSelection;
  protected readonly defaultSortInfo = defaultSortInfo;
}
```
