JSPM

@public-ui/react

4.0.0-alpha.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1372
  • Score
    100M100P100Q102548F
  • License EUPL-1.2

React framework adapter for KoliBri - The accessible HTML-Standard.

Package Exports

  • @public-ui/react

Readme

KoliBri - React-Adapter

Motivation

Provide an adapter for React to use the KoliBri components.

Installation

You can install the adapter with npm, pnpm or yarn:

npm i -g @public-ui/react
pnpm i -g @public-ui/react
yarn add -g @public-ui/react

Usage

First, initialize KoliBri with a theme and create a React root:

import { defineCustomElements } from '@public-ui/components/dist/loader';
import { register } from '@public-ui/components';
import { DEFAULT } from '@public-ui/themes';

register(DEFAULT, defineCustomElements)
  .then(() => {
    ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
      <React.StrictMode>
        <App />
      </React.StrictMode>
    );
  })
  .catch((error) => {
    /* Handle errors */
  });

Then, you can import any component from @public-ui/react and render it within React components:

import React from 'react';
import type { FC } from 'react';
import { KolButton } from '@public-ui/react';

export default (): FC => <KolButton _label="Hello World" />;