Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions samples/layouts/accordion/programmatic-expansion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!-- NOTE: do not change this file because it's auto re-generated from template: -->
<!-- https://github.com/IgniteUI/igniteui-react-examples/tree/vnext/templates/sample/ReadMe.md -->

This folder contains implementation of React application with example of Programmatic Expansion feature using [Accordion](https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html) component.


<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<body>
<a target="_blank" href="https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem" alt="View Docs" src="https://dl.infragistics.com/x/img/browsers/button-docs.png"/>
</a>
<a target="_blank" href="./src/index.tsx" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="View Code" src="https://dl.infragistics.com/x/img/browsers/button-code.png"/>
</a>
<a target="_blank" href="https://www.infragistics.com/react-demos/samples/layouts/accordion/programmatic-expansion" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://dl.infragistics.com/x/img/browsers/button-run.png"/>
</a>
<a target="_blank" href="https://codesandbox.io/s/github/IgniteUI/igniteui-react-examples/tree/master/samples/layouts/accordion/programmatic-expansion?fontsize=14&hidenavigation=1&theme=dark&view=preview&file=/src/index.tsx" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://dl.infragistics.com/x/img/browsers/button-sandbox.png"/>
</a>
</body>
</html>

## Branches

> **_NOTE:_** You should use [master](https://github.com/IgniteUI/igniteui-react-examples/tree/master) branch of this repository if you want to run samples on your computer. Use the [vnext](https://github.com/IgniteUI/igniteui-react-examples/tree/vnext) branch only when you want to contribute new samples to this repository.

## Instructions

Follow these instructions to run this example:


```
git clone https://github.com/IgniteUI/igniteui-react-examples.git
git checkout master
cd ./igniteui-react-examples
cd ./samples/layouts/accordion/programmatic-expansion
```

open above folder in VS Code or type:
```
code .
```

In terminal window, run:
```
npm install --legacy-peer-deps
npm run-script start
```

Then open http://localhost:4200/ in your browser


## Learn More

To learn more about **Ignite UI for React** components, check out the [React documentation](https://www.infragistics.com/products/ignite-ui-react/react/components/general-getting-started.html).
11 changes: 11 additions & 0 deletions samples/layouts/accordion/programmatic-expansion/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Accordion Programmatic Expansion</title>
<link href="https://dl.infragistics.com/x/css/samples/shared.v8.css" rel="stylesheet" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
42 changes: 42 additions & 0 deletions samples/layouts/accordion/programmatic-expansion/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "react-accordion-programmatic-expansion",
"description": "This project provides example of Accordion Programmatic Expansion using Infragistics React components",
"author": "Infragistics",
"homepage": ".",
"version": "1.4.0",
"private": true,
"scripts": {
"start": "vite --port 4200",
"build": "tsc && node --max-old-space-size=4096 node_modules/vite/bin/vite build",
"preview": "vite preview",
"test": "vitest"
},
"dependencies": {
"igniteui-dockmanager": "^1.17.0",
"igniteui-react": "19.7.0",
"igniteui-react-core": "19.6.0",
"igniteui-webcomponents": "^7.2.1",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"tslib": "^2.4.0"
},
"devDependencies": {
"@types/jest": "^29.2.0",
"@types/node": "^24.7.1",
"@types/react": "^18.0.24",
"@types/react-dom": "^18.0.8",
"@vitejs/plugin-react": "^5.0.4",
"@vitest/browser": "^3.2.4",
"typescript": "^4.8.4",
"vite": "^7.1.9",
"vitest": "^3.2.4",
"vitest-canvas-mock": "^0.3.3",
"worker-loader": "^3.0.8"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"infiniteLoopProtection": false,
"hardReloadOnChange": false,
"view": "browser"
}
26 changes: 26 additions & 0 deletions samples/layouts/accordion/programmatic-expansion/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* shared styles are loaded from: */
/* https://dl.infragistics.com/x/css/samples/shared.v8.css */

igc-accordion {
width: 100%;
}

.button-group {
display: flex;
gap: 8px;
padding: 16px;
}

.button-group igc-button {
min-width: 96px;
}

.sample-wrapper {
overflow-y: auto;
max-height: 380px;
margin: 8px;
}

igc-expansion-panel {
border: 1px solid rgba(174, 174, 174, 0.25);
}
42 changes: 42 additions & 0 deletions samples/layouts/accordion/programmatic-expansion/src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React, { useRef } from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { IgrAccordion, IgrButton, IgrExpansionPanel } from 'igniteui-react';
import 'igniteui-webcomponents/themes/light/bootstrap.css';

export default function AccordionProgrammaticExpansion() {
const accordionRef = useRef<IgrAccordion>(null);

return (
<div id="root">
<div className="button-group">
<IgrButton variant="contained" onClick={() => accordionRef.current?.showAll()}>
<span>Show All</span>
</IgrButton>
<IgrButton variant="contained" onClick={() => accordionRef.current?.hideAll()}>
<span>Hide All</span>
</IgrButton>
</div>
<div className="sample-wrapper">
<IgrAccordion ref={accordionRef}>
<IgrExpansionPanel>
<span slot="title">Billing</span>
<span>Review invoices, update payment methods, and manage billing contacts.</span>
</IgrExpansionPanel>
<IgrExpansionPanel>
<span slot="title">Security</span>
<span>Configure password rules, multi-factor authentication, and recovery options.</span>
</IgrExpansionPanel>
<IgrExpansionPanel>
<span slot="title">Notifications</span>
<span>Choose which product updates and account alerts are sent to your team.</span>
</IgrExpansionPanel>
</IgrAccordion>
</div>
</div>
);
}

// rendering above component to the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<AccordionProgrammaticExpansion />);
44 changes: 44 additions & 0 deletions samples/layouts/accordion/programmatic-expansion/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"baseUrl": ".",
"outDir": "build/dist",
"module": "esnext",
"target": "es5",
"lib": [
"es6",
"dom"
],
"sourceMap": true,
"allowJs": true,
"jsx": "react-jsx",
"moduleResolution": "node",
"rootDir": "src",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"noUnusedLocals": false,
"importHelpers": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"strict": false,
"isolatedModules": true,
"noEmit": true
},
"exclude": [
"node_modules",
"build",
"scripts",
"acceptance-tests",
"webpack",
"jest",
"src/setupTests.ts",
"**/odatajs-4.0.0.js",
"config-overrides.js"
],
"include": [
"src"
]
}
12 changes: 12 additions & 0 deletions samples/layouts/accordion/programmatic-expansion/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
plugins: [react()],
build: {
outDir: 'build'
},
server: {
open: false
},
});