@beeq/react package provides lightweight React wrappers around every BEEQ web component. It solves two fundamental incompatibilities between React and Custom Elements.
Why a React wrapper?
React and Custom Elements do not integrate well out of the box:- Rich data — React passes all props as HTML attributes, so objects and arrays become the string
"[object Object]"instead of being forwarded as JavaScript values. - Custom events — React’s synthetic event system does not listen for DOM custom events emitted by web components. Without a wrapper, you must grab a
refand calladdEventListenermanually for every event.
@beeq/react solves both problems by exposing native React components that map props and events to the underlying custom element.
Installation
Install the packages
@beeq/core is a peer dependency of @beeq/react. Both packages must be installed.Import BEEQ styles
Import the BEEQ global stylesheet at the top of your application entry file:Or import it directly in your entry TypeScript/JavaScript file:
main.css
main.tsx
Copy SVG icon assets
BEEQ loads SVG icons at runtime. Use Then set the base path in your entry file:
vite-plugin-static-copy to copy the icon assets to your output directory:npm
vite.config.ts
main.tsx
Note the import path:
@beeq/core/dist/components (not @beeq/core) when using setBasePath in a Vite/React project.Usage
Import BEEQ components from@beeq/react and use them like any other React component. Custom events are exposed as onBq* props:
App.tsx
Form input example
LoginForm.tsx