Docs
How to use every feature, one page each, with a live demo you can try and the code that runs it. (95 pages)
Basics
- Getting started▶FreeGrid is a framework-free TypeScript grid with thin React, Vue, Svelte and Angular wrappers. Install the core package, or the wrapper for your…
- Writing code with AIWhen you ask ChatGPT, Claude, Gemini, Cursor or another AI tool for FreeGrid code, have it read https://freegrid.app/llms-full.txt first: every option,…
- Grid optionsEvery option of createGrid: data, row ids, selection, editing, pagination, summary rows, live updates, conditional formats, themes, fonts and language.
- Data and row idsRows are plain objects; getRowId keeps selection and focus across setData, and noRowsOverlay and loadingOverlay set the empty and loading messages.
Columns and cells
- Column definitionsColumns are plain objects. The column id is id if you set one, otherwise field; sorting, filters and column state all refer to columns by that id.
- Nested fields (address.city)▶field: 'address.city' reads and writes nested objects: display, sort, filter, edit, paste, undo, change tracking and export all follow the path.
- valueFormatter and valueParser▶valueFormatter turns a value into the text shown on screen, in search, tooltips, copy and exports; valueParser turns typed or pasted text back into a value.
- Pinned columns, rows and column groups▶Pin columns left or right and rows to the top or bottom so they stay visible while scrolling, and nest column groups to any depth, collapsible or not.
- Column customization and saved views▶People reorder, resize, hide, pin and autosize columns from the header and the column chooser; getColumnState and getState save each person's layout and view.
- Header height, wrapping and drag to hide▶Wrap long header labels and let the header grow to fit them, hide a column by dragging its header up out of the header, and control which columns can be hidden.
- Keeping the layout after a reload▶stateKey saves column widths, order, hidden and pinned columns, sort and more in the browser and restores them on the next visit; reset columns is remembered and clearSavedState forgets it.
- Column spans, wrapping and row height▶colSpan lets a cell run across columns, wrapText and autoRowHeight wrap long text and grow the row, getRowHeight sets heights per row, and autoHeight drops the inner scroll.
- Fitting column widths to the content▶autoSizeColumns fits the columns to their header and rows once the first rows are drawn, and with 'always' again after new data, leaving columns the user resized alone.
- Formatting, renderers and sparklines▶Numbers and dates formatted for the grid language, custom cell renderers, and sparklines that draw an array of numbers as a small chart in a cell.
- Row colours and classes▶Colour whole rows from their values with rowClass and rowStyle: backgrounds, text colour, bold, italic and strikethrough, kept under the selection colour and written to Excel, print and PDF.
- Buttons, links and images in cells▶Built-in button, link and image cells: clicks do not select the row or start an edit, links take {field} templates and refuse javascript: URLs, and renderers can clean up with destroy.
- Tooltips▶Hover text from the cell value or your own function, header tooltips, and the full text of cut-off cells without any option.
- Tooltip timing and rich tooltips▶Set how fast tooltips appear and how long they stay, put elements with links in them, keep them open while hovered, and see cell notes in the tooltip place.
- Row numbers▶rowNumbers adds a pinned column numbering the data rows 1, 2, 3… in display order, continuing across pages, with your own width and header.
- Conditional formatting▶Colour cells by value or formula, highlight the top and bottom values, averages and duplicates, and draw data bars, colour scales and icon sets that carry into Excel, print and PDF.
- Merged cells▶merge: true joins consecutive cells with the same value into one tall cell, and rowSpan sets how many rows a cell covers, as in a printed report.
- Side bar▶Docked Filters, Columns and Pivot panels on the right of the grid: filter several columns in one place and show, hide and reorder columns.
Sorting and filtering
- Sorting▶Click a header to cycle ascending, descending and unsorted. Shift-click (or Ctrl/⌘-click) adds the column as another sort key; a small number shows its…
- Sorting by size or by casesortAbsolute sorts numbers by their size whatever the sign, and sortCaseSensitive sorts upper and lower case and accents apart.
- Filtering▶Text, number, date and set filters: not contains, one of, wildcards, regex, Korean initials, relative dates like this month, calendars, a filter row and a quick search.
- Text filter operators▶Every text filter operator: contains, does not contain, equals, starts and ends with, one of a list, wildcards with * and ?, regular expressions and blanks, in the menu, the builder and code.
- Date filters and relative dates▶Filter dates by day, before, after, between and relative ranges (today, this week, this month, last N days) that follow the calendar, with calendars in the menu and the filter row.
- Filter row syntax▶What you can type in the filter row under the header: =exact, !not, a | b, wildcards and /regex/ for text, >10 and 10~20 for numbers, ranges and relative names for dates.
- Filters on editor columns▶Columns filter the way they edit: option editors get a list of labels, multi-value cells pass when any value is chosen, periods when they overlap, phone numbers without dashes.
- Korean initial consonant search▶Search Korean text by its initial consonants: ㄱㅎ finds 김하늘, in filters, the filter row, the quick search, the find bar, set-list search, the column chooser and editors.
- Quick search▶One box that searches every shown column: all words must match, "a phrase" matches as written, -word excludes rows, Korean initials work, and option labels are found.
- Advanced filter▶Conditions across columns joined with AND and OR, nested to any depth, from a builder dialog or setAdvancedFilter, applied with the column filters.
Rows
- Row selection▶Single or multiple row selection with checkboxes, Ctrl, Shift and Space; isRowSelectable decides which rows can be checked.
- Selecting text in cellscellTextSelection lets people drag over cell text to select and copy part of it, as on a web page, instead of selecting a range of cells.
- Tree data▶Show org charts, folders and bills of materials as a tree with getParentId, load children from a server on first expand, and check parents with their children.
- Master / detail▶detailRenderer opens a panel under a row with anything in it, such as another grid; isRowMaster limits which rows can open one.
- Opening detail rows▶Open detail rows from the start for every row or some rows, and open or close all of them from code or the context menu.
- Row drag▶Drag rows into a new order, to another parent in a tree, or to another grid, with canDrop rules, undo and events to save the new order.
- Dragging rows between grids▶Grids that share a rowDrag group exchange rows: a drop moves the row, rowDrag.copy (or Ctrl while dropping) copies it, copyRow gives the copy a new id, canDrop refuses targets.
- Pagination▶Show rows one page at a time with a pager and a rows-per-page picker; setPage, setPageSize and pageChange work from code, in the browser or on a server.
- Page numbers and the page box▶Show page number buttons around the current page and a box to type a page number, next to the first, previous, next and last buttons and the page size list.
- Status bar▶statusBar adds a bar under the rows with the row count, the filtered count and the number of checked rows, in the grid's language.
Grouping and totals
- Row grouping▶groupBy gathers rows under group rows with counts and aggFunc totals; people can group by dragging headers into the group panel.
- Show values as % or running total▶Show a number column as a share of the total, a share of its group or a running total, from the header menu or code; the values themselves, sorting, filters and exports stay as they are.
- Merge rows by columns▶Load raw rows and merge them by columns: hide or remove one of the by columns and rows that agree on the rest become one, with sums, averages, min, max or counts.
- Summary rows▶Summary rows show totals, averages and other aggregates. Put them at the top or bottom; keep them pinned outside the scroll area, or let them scroll with…
- Pivot tables and charts▶setPivot() turns the rows into a summary table. Fields in rows become the rows; with more than one, the earlier ones become groups with their own…
Editing
- Editing▶Edit cells in place with calendars, date ranges, combo, multi-select, radio, switch, number, phone-number mask and dialog editors, per-cell editable rules, row editing and cancellable changes.
- Date editor (calendar)▶A calendar under the cell for date columns: pick or type a day, move by day, month or year from the keyboard, limit the days with min, max and disabledDates.
- Date range editor▶Edit a period with two months side by side: click the first and the last day, or use presets such as the last 7 days; values stay text, arrays or { start, end } objects.
- Combo editor (autocomplete)▶A text box with a list that filters as you type: pick with the arrows, allow free text or only listed values, and search a server with an async options function.
- Select editor and cascading lists▶A drop-down of fixed choices with labels, disabled options and a placeholder; options from the row make dependent lists, and dependsOn clears a child value that no longer fits.
- Radio editor▶A short list of choices shown at once: one click picks and saves, the arrow keys move the choice, and the cell shows the option label.
- Multi-select editor▶Pick several values from a checkbox list with Select all and search; arrays stay arrays, text is joined with a separator, and filters match any chosen value.
- Switches and column checkboxes▶A switch in the cell that flips with one click or Space between true / false or values like 'Y' / 'N', and a header checkbox that turns a whole column on or off.
- Number editor▶A number box with ▲▼ buttons and arrow-key steps, Shift for ten steps, decimal steps without rounding errors, and min / max limits checked on edit, paste and fill.
- Formatted input (phone numbers, business numbers)▶Type into a fixed format: Korean phone numbers (010, 02, 1588), business registration numbers, card numbers, postal codes or your own pattern; dashes appear as you type.
- Dialog editor for long text▶Edit long text in a dialog with a character count: Enter for new lines, Ctrl+Enter or Save to save, Escape to cancel, and singleClickEdit to open it with one click.
- Cell notes▶Notes on cells: add, edit and delete them from the context menu, see them on hover with a red corner mark, undo them, keep them in saved state and export them as Excel comments.
- Validation and change tracking▶required, unique and validate keep bad values out, validate() checks every row before saving, and getModifiedRows, undo and commitChanges track every edit.
- Checking only some rows▶validate() with rows, columns or only changed rows, and validateCell() for one cell, so a save button checks just what will be sent.
- Copy and paste▶Ctrl+C copies the focused cell or the checked rows for Excel, Ctrl+V pastes a value converted to the column type, and copyable: false keeps columns out.
- Pasting more rows than there are▶With pasteAddsRows, lines pasted past the last row become new rows made by your function, checked by the column rules, tracked as created and undone together with the paste.
- Keyboard▶Arrow keys, Tab, Home/End and Page keys move the focused cell, Enter edits and Ctrl+Z undoes; keymap remaps or turns off keys.
Spreadsheet tools
- Formulas▶A spreadsheet-style formula engine: computed columns, about 60 functions, whole-column totals with COL(), running totals with PREV(), formulas typed into cells and your own functions.
- Calculated columns from the menu▶Let people add their own formula columns: a dialog with the fields to click in, a live preview and errors; edit and remove them from the menu, keep them with stateKey, or add them from code.
- Cell ranges and range copy▶Excel-style cell ranges by drag, Shift and Ctrl, copied to and pasted from Excel as blocks, cut, cleared and totalled in the status bar.
- Fill handle▶Drag the corner of a selection to fill editable cells: numbers and dates continue their step and numbered text counts up, in one undo step.
- Find▶Ctrl+F opens a find bar inside the grid that searches every row, highlights matches and steps through them; find() does the same from code.
- Context menu▶The right-click menu of a cell with copy, paste, pin, hide, export and print, and contextMenu to add, reorder or replace its items.
- Building your own context menu▶Build the right-click menu from built-in entries by name and your own entries: submenus, icons, check marks, headings, hidden and danger entries, and a separate menu for headers.
Live data
Server and files
- Server data and infinite scroll▶Load rows from your server in blocks as people scroll with a datasource; sorting, filters and the quick search go along, with infinite scroll or pages.
- Changes on server rows▶With a datasource, applyTransaction updates loaded rows in place with a flash, and adds or removes reload the loaded blocks while the old rows stay on screen; refreshRows({ keepRows }) does it by hand.
- Server-side grouping▶groupBy with a datasource asks your server one group level at a time, so a GROUP BY query answers groups with counts and totals.
- Server examples (Java, Node, Python, PHP, C#, Go)Server helpers in six languages turn the grid’s requests into safe SQL: paging, sorting, filters, quick search, the advanced filter, server-side grouping and saving changes.
- CSV, JSON and import▶exportCsv and exportJson save what people see, and importFile reads .xlsx and CSV files back in, checking every value like a paste.
- Exporting all, shown or selected rows▶rows: 'filtered' (default), 'all' or 'selected' and columns: [...] choose what CSV, Excel, JSON, print and PDF exports contain, hidden columns included.
- Excel and PDF export▶exportXlsx writes real Excel files with formats, colours and merged headers, exportWorkbook puts several grids in one file, and exportPdf saves the print layout.
- Excel: totals, groups, notes, pictures, protection▶Excel export options: summary rows, a row per group with counts and aggregates, row colours, cell notes as comments, pictures from image columns, and read-only sheets with a password.
- Printing▶print() prints the rows on the paper you choose with a title, page numbers and header rows repeated on every page; getPrintHtml gives a preview.
Look and language
- Themes, fonts and density▶Built-in light, dark and Korean-style themes, CSS variables for your own, one option each for font size and family, and compact or comfortable row spacing.
- Languages and right-to-left▶The grid UI in 14 languages, picked from the browser or set with locale, and direction: 'rtl' for Arabic, Hebrew and other right-to-left languages.
- Card view on phones▶cardView turns rows into cards of header: value lines when the grid is narrower than a width you choose, for phones and narrow panels.
- Accessibility and Shadow DOM▶The grid follows the WAI-ARIA grid pattern: role="grid" on the rows area (treegrid when grouped or a tree), header rows, row and column indexes on cells,…
Frameworks
- React▶@freegridjs/react exports <FreeGrid>. Every grid option is a prop and every event is an on… prop. The ref is the grid API. Changing data, columns, theme,…
- Vue▶@freegridjs/vue exports <FreeGrid> for Vue 3.3+. Events are kebab-case (@cell-click, @selection-change…), and the component ref exposes getApi().
- Svelte▶@freegridjs/svelte has a Svelte 5 <FreeGrid> component and a use:freegrid action. Every grid option is a prop and events are on… props such as…
- Angular▶@freegridjs/angular has a standalone <free-grid> component for Angular 17+. Events are outputs with the same names, except (gridPaste) and (gridScroll).…
- TypeScript: typed rowscreateGrid<Order>() and ColumnDef<Order> type the rows: field names and nested paths are completed and checked, row callbacks and API methods use your type.
- Testing your grid@freegridjs/testing reads cells, edits, sorts and presses keys like a user in jsdom, happy-dom or a real browser; mockLayout makes jsdom draw rows; selectors serve Playwright and Cypress.
Reference
- API referencecreateGrid(element, options) returns this API. Calls after destroy() do nothing.
- Finding and changing rows in code▶getRowById, getRowIndex, getDisplayedRows, forEachRow, getCellValue, setCellValue, refreshCells, getFocusedCell and setFocusedCell: read and change rows and cells without reloading the data.
- Events▶
- Grid ready and first rowsgridReady fires right after createGrid returns and firstDataRendered once the first rows are on screen (for a datasource, once the first block arrived), in every framework wrapper.