0.33.0 • Published 3 days ago

@kelvininc/react-ui-components v0.33.0

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
3 days ago

Kelvin React UI Components

Kelvin UI Components provides a set of reusable, high quality framework-agnostic UI components, this means you can use them with the current most popular Front-End Development Frameworks like React, Angular or if you prefer, the components are also available as W3C compliant WebComponents.

This is not just a library of UI components as it's also a style guide where you can see how the component looks and behaves by interacting with it, to showcase this we use Storybook, a free open-source tool.

Our Storybook is publicly available here

Installation

From the command prompt go to your app's root folder and execute:

npm install @kelvininc/react-ui-components --save

Getting Started

Include the fonts in index.js or index.tsx.

import '@kelvininc/react-ui-components/assets/fonts/font-proxima-nova.css';

Now you are ready to use all available Kelvin UI Components. For example:

import { EActionButtonType, KvActionButton } from '@kelvininc/react-ui-components';

(...)

<KvActionButton
	type={EActionButtonType.PrimaryButton}
	text="My Button"
	smallSize="true"
	fixedWidth={250}
	onButtonClick={this.onButtonClick}>
</KvActionButton>

Including the global style file you can access our foundation design system definitions like colors, spacings and typography

@import '@kelvininc/react-ui-components/assets/styles/globals.scss';

Themes

Kelvin UI Components have two predefined themes StyleMode.Night and StyleMode.Light (StyleMode.Night is applied by default) that can be applied on library startup. For that you need pass the desired theme to the library configuration in your index.js or index.tsx.

import { initialize, StyleMode } from '@kelvininc/react-ui-components';

(...)

initialize({styleMode: StyleMode.Light});

Example: Setting the Primary Color

:root {
	--kv-primary: #005cc7;
	--kv-primary-rgb: 0, 92, 199;
	--kv-primary-contrast: #fff;
	--kv-primary-contrast-rgb: 255, 255, 255;
	--kv-primary-dark: #0051af;
	--kv-primary-light: #ccdef4;
}

Caching

By default, the KvIcon and KvIllustration components require an SVG file with all the kv-icons available. The default file is svg-symbols.svg which is provided after installing this dependency. For caching purposes, it is also provided a symbols.${checksum}.svg file after installation. If you are caching those SVGs in your project you should use the latter.

import { initialize } from '@kelvininc/react-ui-components';

(...)

initialize({ symbolsFileName: 'symbols.6e51ea0e37926eff2f3ef11e64be70fa.svg' });

NOTE: If you are using pnpm as package manager in your project it's necessary to configure the postinstall script into package.json. Add "postinstall": "CUSTOM_INST=true node ./node_modules/@kelvininc/react-ui-components/.scripts/copy-icons.js". This will grant that svg symbols are copied to public directory.

Relative paths

By default the KvIcon and KvIllustration components will expect the svg-symbols.svg file to be served at the server root. This could not be your use-case if you're application is being served on a relative path, e.g, https://dashboard.com/clients/home. In this case you will need to tell the library the base path to your assets url, which you can achieve by doing the following in your index.js or index.tsx.

import { initialize } from '@kelvininc/react-ui-components';

(...)

initialize({ baseAssetsUrl: '/clients/' });

For more information, visit our Storybook.

0.33.0

3 days ago

0.32.0

22 days ago

0.31.1

1 month ago

0.31.0

2 months ago

0.30.0

2 months ago

0.29.1

3 months ago

0.29.0

3 months ago

0.28.0

5 months ago

0.21.0

10 months ago

0.27.0

6 months ago

0.26.0

6 months ago

0.25.1

6 months ago

0.25.0

6 months ago

0.24.0

7 months ago

0.23.0

8 months ago

0.22.0

8 months ago

0.20.0

11 months ago

0.19.0

1 year ago

0.17.0

1 year ago

0.18.0

1 year ago

0.14.0

1 year ago

0.15.0

1 year ago

0.16.0

1 year ago

0.13.0

2 years ago

0.10.0

2 years ago

0.11.0

2 years ago

0.12.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.3

2 years ago

0.5.2

2 years ago

0.5.0

2 years ago

0.4.1-alpha.38

2 years ago

0.0.2-alpha.21

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago