Guides
Usage and Billing Portal

Embeddable UI Kit - React.js

10min

Embeddable UI components for React.js applications

The Amberflo UI Kit is a React component library for Amberflo accounts to be able to consume and make use of principal Amberflo views, for one of their customers, on their own site.

If you are trying to use this widgets on a non React.js environment, you can use the vanilla.js library as well.

Installation

Run yarn add @amberflo/uikit or npm install @amberflo/uikit to install Amberflo UI Kit in your React project.

📘Technologies

React >= v17.0.2 Node v16.13.1 Typescript v4.5.5

Available Versions

All versions can be found on npm repository: @amberflo/uikit

Getting Started

Amberflo Provider

The AmberfloProvider is a Provider component that needs to wrap your app, so the components can hit our API. It requires a customer-specific session and a theme. You can check here how to:

HTML


Imports

To import a single Amberflo UI Kit component into your application (Recommended):

JS


Theming

In order to customize components with a theme add a theme prop to the AmberfloProvider with the following object:

JS


We have added some class names to most of our components, you will be able to identify them, once they are placed on your app, by the starting name of aflo-. You can use this classes along with the material UI classes in your own css file.

So for instance, if you want to set a dark mode, to make it look something like this:

Document image


You can add some styles like:

CSS


This way you can change the text color for the whole components to white. And in the buttons that have a light background, we can set a dark color as black.

Types

Amberflo UI Kit is heavily typed, which will allow, if you use typescript on your project, to easily see which kind of properties a component receives, or what would return a specific function or hook.

Invoice-related Options

There are a few UI Kit components that display invoice-related data (i.e. Invoice List, Invoice Details, Invoice PDF). There are invoice-related settings a user can update at Amberflo | Settings | Invoice which affect how invoices are displayed through UI Kit components (as well as the customer portal and in the main-app).

The current available option/settings are:

  • Displaying cached invoices
    • Invoice data displayed will either be cached data or real-time data.
    • Cached data is used to speed up how quickly invoice data can be retrieved.
  • Group product items on invoices
    • We list all product items and allow user to create categories to group on the invoices.

How to

Read how to use hooks in here

Appendix 1: Full Code Example

JS