React
HTMLPLUS elements are fully compatible with React library.
#
Install
Install HTMLPLUS package into React application.
npm install @htmlplus/ui
#
Usage
Import the reference of elements.
import '@htmlplus/ui';
const App = () => <plus-switch/>;
export default App;
#
Properties
To set properties and attributes.
import '@htmlplus/ui';
const App = () => <plus-switch disabled/>;
export default App;
#
Events
To handle event's callback.
import '@htmlplus/ui';
const App = () => <plus-switch onPlusChange={() => alert('The switch toggled!')} />;
export default App;
#
Global Config
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App.js';
// Setup the global config.
import { setConfig } from '@htmlplus/ui/config.js';
setConfig({
// ...
});
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);