# Recipes

> Task-focused guides with complete code for every Birch UI product, from persisting grid state to importing MS Project files.

Each recipe solves one concrete task end to end: the setup, complete code you can paste, how it works, and the pitfalls. Most include a live demo. There are 33 recipes.

## Data grid

| Recipe | What you build |
| --- | --- |
| [Persist grid state to localStorage](https://docs.birchui.com/recipes/grid-persist-state.md) | Save sorting, filters, column layout, selection and expansion with getState() and restore them with setState() on the next visit. |
| [Load rows from a REST API](https://docs.birchui.com/recipes/grid-server-side-rest.md) | Connect the server-side row model to a REST endpoint with fetch, translate each block request into a query string and cancel stale requests with AbortSignal. |
| [Load rows from GraphQL](https://docs.birchui.com/recipes/grid-server-side-graphql.md) | Back the server-side row model with a GraphQL query, passing sort, filters and the requested block as variables and cancelling stale queries. |
| [Excel export with custom styles](https://docs.birchui.com/recipes/grid-excel-custom-styles.md) | Export the grid view to .xlsx and restyle it to match your brand, with a title row, coloured headers, conditional fills and number formats. |
| [Editable grid with validation and undo](https://docs.birchui.com/recipes/grid-editing-validation-undo.md) | Validate user input with valueParser and editable callbacks, show feedback, and let users undo and redo edits with undoRedo, api.undo() and api.redo(). |
| [Nested grids in master/detail](https://docs.birchui.com/recipes/grid-master-detail-nested.md) | Show each customer's orders in a nested grid, and each order's lines in a third level, with MasterDetailModule and correct cleanup. |
| [Show a million rows](https://docs.birchui.com/recipes/grid-million-rows.md) | Render, sort and scroll one million client-side rows with row and column virtualization, and the habits that keep a large grid fast. |
| [Keyboard-only workflows](https://docs.birchui.com/recipes/grid-keyboard-workflows.md) | Set up a grid that power users and keyboard-only users can drive end to end, from navigation and editing to menus, filters, undo, ranges and the clipboard. |
| [Translate the grid and support right-to-left](https://docs.birchui.com/recipes/grid-i18n-rtl.md) | Run the grid in German with a bundled locale pack, add your own Arabic strings with plural forms, and lay it out right to left. |
| [Migrate an AG Grid app with the CLI](https://docs.birchui.com/recipes/grid-migrate-ag-grid-cli.md) | Move an existing AG Grid code base to Birch UI Grid with birchui-migrate, from a dry run and report to applying the changes and clearing manual steps. |
| [Match your design system](https://docs.birchui.com/recipes/grid-design-system-theme.md) | Map your design tokens onto the grid's --lq-* custom properties to build a named theme with light and dark variants, density and accessible contrast. |
| [Birch UI Grid in the Next.js App Router](https://docs.birchui.com/recipes/grid-nextjs-ssr.md) | Render the grid from a Client Component in the Next.js App Router, load data in a Server Component, lazy-load Grid Pro and pass the license key from an environment variable. |
| [Grid Pro in an Angular standalone app](https://docs.birchui.com/recipes/grid-angular-standalone.md) | Use the birchui-grid component in a standalone, zoneless Angular app with signal inputs, a computed options object, outputs and Grid Pro modules. |
| [Collapsible column groups](https://docs.birchui.com/recipes/grid-column-groups.md) | Group related columns under shared headers with ColumnGroupDef, make groups collapsible with columnGroupShow, and open or close them from code. |
| [Custom cell context menu](https://docs.birchui.com/recipes/grid-context-menu.md) | Add row actions to the grid's right-click menu, keep or drop the built-in copy and export items, and disable the menu entirely with the contextMenu option. |
| [Streaming live updates](https://docs.birchui.com/recipes/grid-live-updates.md) | Apply a stream of WebSocket messages to the grid with batched applyTransaction calls, flash changed cells and keep sorting and selection stable. |
| [Import an Excel file into a grid](https://docs.birchui.com/recipes/grid-import-xlsx.md) | Read an uploaded .xlsx file with readXlsx, turn its rows into typed records with sheetToObjects, validate them and show them in a grid for review. |

## Pivot Studio

| Recipe | What you build |
| --- | --- |
| [Save and load pivot layouts](https://docs.birchui.com/recipes/pivot-saved-layouts.md) | Let users save named Pivot Studio layouts as PivotReport JSON, keep them in localStorage or on your server, and open them again. |
| [Load pivot data from an API or CSV](https://docs.birchui.com/recipes/pivot-from-api.md) | Fetch records from a JSON API or a CSV export, clean them with parseCsv or csvToRecords, and load them into Pivot Studio with loading and error states. |

## Scheduler

| Recipe | What you build |
| --- | --- |
| [Validate scheduler drag and drop](https://docs.birchui.com/recipes/scheduler-drag-validation.md) | Combine validateDrop and validateResize to block double bookings, keep jobs inside working hours and only assign work to qualified technicians. |
| [Schedule recurring maintenance jobs](https://docs.birchui.com/recipes/scheduler-recurring-jobs.md) | Model planned maintenance with SchedulerEvent.rrule and exdates, let users edit one occurrence or the whole series, and store detached occurrences. |
| [Undo and redo in the scheduler](https://docs.birchui.com/recipes/scheduler-undo-redo.md) | Turn on scheduler history with the undoRedo option, add undo and redo buttons driven by historyChange, and keep a server in step when users undo. |
| [Save scheduler changes to a server](https://docs.birchui.com/recipes/scheduler-save-to-server.md) | Persist every scheduler edit from historyChange, batch requests, roll back changes the server rejects, and apply updates from other users without echoing them back. |

## Gantt

| Recipe | What you build |
| --- | --- |
| [Import and export MS Project files](https://docs.birchui.com/recipes/gantt-ms-project-import.md) | Let users open MS Project XML files in the Gantt with a preview step, keep your own task fields across a round trip, and export the schedule back to XML. |
| [Build a critical path report](https://docs.birchui.com/recipes/gantt-critical-path-report.md) | Use the headless Gantt engine to compute the critical path, slack and constraint conflicts of a project, and render them as a report or an Excel file. |

## Spreadsheet

| Recipe | What you build |
| --- | --- |
| [Add custom worksheet functions](https://docs.birchui.com/recipes/spreadsheet-custom-functions.md) | Define reusable workbook functions with LAMBDA and defined names, share them across sheets, and test them with the headless formula engine. |
| [Load and save xlsx files](https://docs.birchui.com/recipes/spreadsheet-load-save-xlsx.md) | Open xlsx files from a file input, a URL or drag and drop, save them back to a server as xlsx or workbook JSON, and convert files on the server without the component. |

## Forms

| Recipe | What you build |
| --- | --- |
| [Save Form Builder schemas and render them](https://docs.birchui.com/recipes/forms-builder-save-schemas.md) | Persist schemas from the Form Builder with versioning and server-side checks, then load the published version and render it with createForm. |
| [Validate form submissions on the server](https://docs.birchui.com/recipes/forms-server-validation.md) | Re-check submitted answers on the server with JSON Schema and the expression engine, run async checks while users type, and show the server's errors next to the right fields. |

## Event Calendar

| Recipe | What you build |
| --- | --- |
| [Publish and subscribe to iCalendar feeds](https://docs.birchui.com/recipes/calendar-ical-feed.md) | Serve a team's events as a subscribable .ics feed with toICS, show external feeds in the Event Calendar with parseICS, and import .ics files without duplicates. |

## Charts

| Recipe | What you build |
| --- | --- |
| [Build a chart dashboard from a grid](https://docs.birchui.com/recipes/charts-dashboard-from-grid.md) | Drive several charts from the rows a Birch UI Grid shows, so filtering the grid updates the dashboard, and chart a selected range with chartFromRange. |

## Diagram

| Recipe | What you build |
| --- | --- |
| [Save, load and auto-arrange diagrams](https://docs.birchui.com/recipes/diagram-save-load-layout.md) | Persist diagrams as DiagramDocument JSON, restore them with fromJSON, lay out graphs that arrive without coordinates, and keep layout results out of your change log. |

## Excel Engine

| Recipe | What you build |
| --- | --- |
| [Build a multi-sheet Excel report](https://docs.birchui.com/recipes/excel-report-workbook.md) | Write a styled monthly report with a summary sheet, a detail sheet and per-depot outlines using writeXlsx, with cross-sheet formulas and cached values. |

## More help

- [Examples gallery](https://docs.birchui.com/getting-started/examples.md) for complete starter apps.
- Troubleshooting pages in each product section, starting with the [grid](https://docs.birchui.com/grid/troubleshooting.md).
