React UI Components Documentation
The React Ribbon can be used as a tabbed toolbar or a mega menu. This guide adds the React Ribbon (jqxRibbon) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-react-tsx/jqxribbon 
In a React project (to start one, see Getting started with React), add the package:
npm install jqwidgets-scripts
import JqxRibbon from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxribbon';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.tailwind-blue-dark.css';
jqx.base.css is required. The second file is a theme; pick one of the jqx.*.css files (material, fluent, light, dark and more) and pass its name to the theme prop.
The source of the live Ribbon at the Bottom demo:
import type { JSX } from 'react';
import './App.css';
import JqxRibbon from 'jqwidgets-scripts/jqwidgets-react-tsx/jqxribbon';
function App(): JSX.Element {
return (
<JqxRibbon
theme="tailwind-blue-dark"
width={370}
height={350}
position="bottom"
selectionMode="click"
animationType="fade"
>
<ul>
<li style={{ marginLeft: '30px' }}>Browse Books</li>
<li>Shipping</li>
<li>About Us</li>
</ul>
<div>
<div>
<table>
<tbody>
<tr>
<td>
<b>Fiction</b>
</td>
<td>
<b>Biography</b>
</td>
<td>
<b>Science</b>
</td>
</tr>
<tr>
<td>
<a href="#">Adventure</a>
</td>
<td>
<a href="#">Biography: General</a>
</td>
<td>
<a href="#">Astronomy</a>
</td>
</tr>
<tr>
<td>
<a href="#">Classics</a>
</td>
<td>
<a href="#">Diaries, Letters & Journals</a>
</td>
<td>
<a href="#">Biology</a>
</td>
</tr>
<tr>
<td>
<a href="#">Historical Fiction</a>
</td>
<td>
<a href="#">Memoirs</a>
</td>
<td>
<a href="#">Geography</a>
</td>
</tr>
<tr>
<td>
<a href="#">Romance</a>
</td>
<td>
<b>Food & Drink</b>
</td>
<td>
<a href="#">Mathematics</a>
</td>
</tr>
<tr>
<td>
<a href="#">Science Fiction</a>
</td>
<td>
<a href="#">General Cookery</a>
</td>
<td>
<a href="#">Physics</a>
</td>
</tr>
<tr>
<td>
<a href="#">Thrillers</a>
</td>
<td>
<a href="#">National Cuisine</a>
</td>
<td />
</tr>
<tr>
<td />
<td>
<a href="#">Quick & Easy Cooking</a>
</td>
<td />
</tr>
<tr>
<td />
<td>
<a href="#">Vegetarian Cookery</a>
</td>
<td>
<a href="#">More books</a>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td>
<a href="#">Countries we ship to</a>
</td>
</tr>
<tr>
<td>
<a href="#">Delivery options</a>
</td>
</tr>
<tr>
<td>
<a href="#">Order cancellation and returns</a>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td>
<a href="#">Contact us</a>
</td>
<td rowSpan={3} style={{ width: '125px' }} />
<td rowSpan={3}>
<img
src="https://www.jqwidgets.com/react/images/bookshop.png"
alt="Bookshop"
/>
</td>
</tr>
<tr>
<td>
<a href="#">Jobs</a>
</td>
</tr>
<tr>
<td>
<a href="#">Affiliates</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</JqxRibbon>
);
}
export default App;Options are props. Keep objects such as the data adapter and the columns stable across renders with useMemo, so the component does not reload them.
Each event is a prop named on plus the event name with a capital first letter. For example, change: This event is triggered when the user selects or unselects an item.
const handleChange = (event: any): void => {
console.log(event.args);
};
return <JqxRibbon onChange={handleChange} />;
Call methods through a ref. For example, val: Sets or gets the selected index.
import { useRef } from 'react';
const myRibbon = useRef<JqxRibbon>(null);
const onClick = () => {
const value = myRibbon.current!.val();
console.log(value);
};
return <JqxRibbon ref={myRibbon} />;
Every component also has setOptions({ … }) and getOptions('name'), to change or read options after the first render.