This repository contains over 900 examples on how to use Ignite UI for React components:
- Charts: Area, Bar, Column, Composite, Donut, Financial/Stock, Line, Pie, Polar, Radial, Scatter, Shape, Sparkline, Stacked, Step,
- Maps: Geographic Map, Treemap,
- Gauges: Bullet Graph, Linear Gauge, Radial Gauges
- Grids & Lists: Grid, List, Tree, Table / Grid, Spreadsheet
- Other: Dock Manager, Date Picker, Multi-Column Combobox
NOTE: Use the master branch to run samples locally. Use the vnext branch only when contributing new samples.
Browse all samples in the React Samples Browser, or with documentation in the React Help.
Each sample folder is also a standalone project with its own README, e.g. ./samples/charts/category-chart/overview/README.md.
Clone the repository and install dependencies from the root:
git clone https://github.com/IgniteUI/igniteui-react-examples.git
cd igniteui-react-examples
git checkout master
npm installnpm run devOpen http://localhost:4200. The index lists every component; the sidebar lists every sample. Samples compile on demand, so there is no copy or full build step, and edits to samples/ reload in place.
Every sample under samples/{group}/{component}/{name}/ runs on its own:
cd samples/charts/category-chart/overview
npm install
npm startThen open http://localhost:4200.
npm run build
npm run previewnpm run build first copies the Ignite UI theme sheets to public/ig-themes/ and generates public/code-viewer/**/*.json (the source tabs of the docs code viewer), then builds every sample page into dist/. npm run preview serves dist/ on http://localhost:4200.
The deployed site lives under a sub-path. Set BASE_PATH for both commands to reproduce it:
BASE_PATH=/react-demos npm run build
BASE_PATH=/react-demos npm run previewSmoke tests run in Playwright against the production build:
npx playwright install --only-shell chromium # once
npm run build
npm run test:smokeUse the same BASE_PATH for the build and the tests. CI builds and tests with BASE_PATH=/react-demos.
-
Create a branch from
vnext. -
Scaffold the sample:
npm run add:sample inputs/button/new-thing
The folder must be exactly
samples/{group}/{component}/{name}/, with:src/index.tsx:export defaultthe sample component, and end with the standalone mount (root.render(<Sample />)). The samples browser strips that mount and renders the default export itself; the build fails if either is missing.index.html: the standalone entry,<div id="root">only.package.json: dependencies for running standalone. Its presence is what adds the sample to the browser.
Import theme and sample CSS from
src/index.tsx(e.g.import './index.css';) so the page puts it in<head>at first paint. -
Start the dev server and verify:
npm run dev
- the sample appears in the sidebar
- it loads without errors in the browser console
-
Type-check it along with every other sample (CI runs the same check):
npm run check:samples
-
Commit, push, and open a pull request targeting
vnext. Include a screenshot of the running sample.
Do not edit version strings in package.json files by hand; CI fails when a sample's versions drift from the list.
- Update the versions in ./scripts/lib/versions.js:
SHAREDapplies to the root and every sample,TOOLINGto samples only. - Run from the repo root:
npm run update:ig npm install
- Create and merge a pull request with the updated
package.jsonfiles. - Create a second pull request with the same versions in
/editor-templates/react/main-template/package.jsonof the igniteui-xplat-examples repository.
| Script | Description |
|---|---|
npm run dev |
Start the Astro dev server on port 4200 |
npm run build |
Copy themes, generate code-viewer JSON, build the static site to dist/ |
npm run preview |
Serve dist/ on port 4200 |
npm run test:smoke |
Run the Playwright smoke tests against the production build |
npm run check |
Type-check src/ and tests/ with astro check |
npm run check:samples |
Type-check every published sample, except the generated ones listed in scripts/lib/skip-type-check.json |
npm run add:sample |
Scaffold samples/{group}/{component}/{name}/ |
npm run update:ig |
Apply scripts/lib/versions.js to every package.json |
npm run generate:code-viewer |
Regenerate public/code-viewer/**/*.json |
npm run copy:themes |
Copy Ignite UI theme sheets to public/ig-themes/ |
To learn more about Ignite UI for React components, check out the React documentation.
