# TableDefinition.customStyle Property

> TableDefinition.customStyle property in the browser TypeScript API, with its type TableDefinition['customStyle'] and a TypeScript example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Property
- **Path:** TX Sheet Control > API Reference > TypeScript API > Browser Editor > TableDefinition > TableDefinition.customStyle Property
- **742 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/tabledefinition/customstyle-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/tabledefinition/customstyle-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/tabledefinition/customstyle-property/llms-full.txt

---

A named sparse table recipe. It applies while its name matches style. Direct formatting overrides table formatting; conditional rules have highest priority.

Owner: [TableDefinition](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/tabledefinition/llms-full.txt). Package: `@txtextcontrol/tx-sheet-control`. Version: **2.0.0**.

### Syntax

```typescript
customStyle?: TableDefinition['customStyle']
```

### Recipe Elements

A recipe contains a name of 1–255 characters and up to thirteen unique elements. Each element has `type`, optional `size` (1–4096 rows or columns), and sparse `formatting`. Roles are `wholeTable`, `headerRow`, `totalRow`, `firstColumn`, `lastColumn`, `firstRowStripe`, `secondRowStripe`, `firstColumnStripe`, `secondColumnStripe`, `firstHeaderCell`, `lastHeaderCell`, `firstTotalCell` and `lastTotalCell`. Stripe sizes default to one.

Formatting supports font family, point size, emphasis, text and fill colors, fill patterns, number format codes and border edges. Table borders additionally accept `horizontal` and `vertical` for internal grid edges. Header and totals roles override stripe roles. Apply recipes using `TableCollection.add` or `Table.update`; snapshots are detached. A different style name selects its own preset without applying this recipe. Names shared by multiple custom recipes must have identical definitions when exporting XLSX.

### Examples

```typescript
import type { Workbook } from '@txtextcontrol/tx-sheet-control';

function configureReport(book: Workbook) {
    const sheet = book.sheets.at(0);
    sheet.range('A1:B4').setValues([['Category', 'Amount'], ['Site', 500], ['Food', 20], ['Program', 30]]);
    const table = sheet.tables.add('BudgetLines', 'A1:B4', {
        style: 'Budget', showRowStripes: true,
        customStyle: { name: 'Budget', elements: [
            { type: 'wholeTable', formatting: { fillColor: '#f2f2f2',
                borderEdges: { horizontal: { style: 'thin', color: '#3c7e51' } } } },
            { type: 'headerRow', formatting: { bold: true, fillColor: '#a4d4b4' } },
            { type: 'firstRowStripe', size: 2, formatting: { fillColor: '#d1e8d8' } }
        ] }
    });
    return table;
}
```

---

## Nearby

- **Previous:** [TableDefinition.style Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/tabledefinition/style-property/llms-full.txt)
- **Next:** [TabularLoadOptions Interface](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/tabularloadoptions/llms-full.txt)
