1.2.0 • Published 2 years ago

@kodebi/libkodebi-ui v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

About The Project

This library was created to cater the design requirements of Kodebi web applications. It provides a basic set of components like Buttons, Inputs, Dropdowns, etc., which come with the default Kodebi styles but are also customizable to a certain degree. Future versions will provide even more components with even more customization options.

Built With

Getting Started

Installation

Install the package via npm

  npm i @kodebi/libkodebi-ui

Run Locally

Clone the project

git clone https://github.com/kodebi/libkodebi-ui.git

Go to the project directory

cd path/to/where_you_cloned_the_repo

Install all the dependencies

npm install

Start Storybook and start developing

npm run storybook

Run Tests

To run tests with the library, run the following command:

npm run test

Usage

Quick Start

In order to use a component in your project, just run the following command:

import { Button } from '@kodebi/libkodebi-ui';

function App() {
	return <Button variant="action" type="submit" label="Test" />;
}

Components

Components from the library come with a default styling, but are also customizable to some extent. In order to give a proper overview, we provide a full list of attributes for each component.

AppShell

PropTypeOptional?Description
childrenReactNodenowraps other components with the shell to inherit the Kodebi styles
defaultStylebooleanyesapplies default kodebi styles

Box

PropTypeOptional?Description
variantBoxVariantnodefines the flex layout of the div
childrenReactNodenopasses children objects to the div
widthstringyescustomizes the width of the Box
heightstringyescustomizes the height of the Box
marginstringyessets a custom margin for the Box
classNamestringyesadds custom styling via classes to the div
paddingstringyessets a custom padding to the div
positionstringyesaccepts fixed, absolute, relative
backgroundColorstringyesgives your Box a proper color
maxWidthstringyessets the maximum width of the div
BoxVariant
PropPass as
defaultstring
centerstring
flex-colstring
flex-col-startstring
flex-space-betweenstring
flex-align-startstring
flex-align-endstring
flexible-flexstring
shelfstring
grid-centerstring

Button

PropTypeOptional?Description
labelstringnogives the Button a label tag
variantButtonStyleyesdefines the style of the Button
typeButtonTypeyessets the button type
widthstringyescustomizes the width of the Button
marginstringyessets a custom margin for the Button
classNamestringyesadds custom styling via classes
onClickfunctionyespasses a function if the Button should perform an action
childrenReactNodeyespasses children objects to the Card component
ButtonStyle
PropPass as
signin (default)string
actionstring
filterstring
ButtonType
PropPass as
button (default)string
submitstring
resetstring

Card

PropTypeOptional?Description
withBordersbooleanyessets a border for the Card component
shadowCardShadowTypeyesdefines the shadow of the border if border is passed as true
centerbooleanyescenters content within the Card
widthstringyescustomizes the width of the Card
heightstringyessets a custom height for the Card
backgroundColorstringyessets a custom backgroundColor for the Card
borderColorstringyessets a custom borderColor for the Card
childrenReactNodeyespasses children objects to the Card component
CardShadowType
PropPass as
nonestring
lightstring
brightstring

Footer

PropTypeOptional?Description
elementReactElement<any>nopass a Link component for internal routing
linksArray of anyyespasses an array of links to the footer
iconsArray of IconWrapperyespasses an arry of icons to the footer

Input

PropTypeOptional?Description
variantInputVariantyesdefines the style of the Input
namestringyesgives the Input a dedicated name tag
idstringyessets an unique id for the Input
typeInputTypeyessets the Input type
widthstringyescustomizes the width of the Input
marginstringyessets a custom margin for the Input
positionLabelPositionyesdefines the relative position of the label
classNamestringyesadds custom styling via classes
placeholderstringyessets a placeholder to display a CTA within the input field
valuestringyesused to react to user inputs
marginRightstringyesdefines a right margin for the label
requiredbooleanyesdefines if the Input is mandatory to be filled out by the user
onChangefunctionyespasses a function if the Input should listen to changes
textareabooleanyesif true, the Input gets replaced with a Textarea
rowsnumberyesdefines how many rows the textarea should span
colsnumberyesdefines how many cols the textarea should span
textLengthstringyessets the overall text length of the textarea
borderColorstringyessets a custom borderColor for the Input
labelColorstringyessets a custom color for the Input label
wrapstringyesdefines if the textarea content should wrap or no
InputVariant
PropPass as
primary (default)string
secondarystring
searchstring
InputType
PropPass as
text (default)string
emailstring
passwordstring
urlstring
searchstring
numberstring
LabelPosition
PropPass as
abovestring
leftstring

LinkWrapper

PropTypeOptional?Description
typeLinkTypeyesaccepts default, menu and footer for styling
childrenReactNodeyespasses children objects to the LinkWrapper component
LinkType
PropPass as
defaultstring
menustring
footerstring

IconWrapper

PropTypeOptional?Description
hrefstringyespasses the path to link to external URLs
fontSizestringyessets the size of the icon wrapper
childrenReactNodeyespasses children objects to the IconWrapper component

Dropdown

PropTypeOptional?Description
optionsArray of Optionsyespass an array of options to choose from
variantDropdownTypeyesdefines the style of the Dropdown menu
namestringyesgive the Dropdown a dedicated name tag
idstringyesset an unique id for the Dropdown
widthstringyescustomizes the width of the Select component
marginstringyessets a custom margin for the Select component
paddingstringyessets a padding for the Dropdown
classNamestringyesadds custom styling via classes
placeholderstringyessets a placeholder to display a CTA within the select field
valuestringyesused to react to user inputs
labelbooleanyesdefines if the Dropdown needs a label tag or not
positionLabelPositionyesdefines the relative position of the label
onChangefunctionyespasses a function if the Dropdown should listen to changes
Options
PropTypeOptional?Description
keystringyespasses the index of the array as unique key
valuestring or numberyessets a value for the option component
widthstringyessets a custom width for the option
classNamestringyesadds custom styling via classes
onClickfunctionyespasses a function which propagates to the Select component
DropdownType
PropPass as
defaultstring
filterstring

Text

PropTypeOptional?Description
weightTextWeightyesdefines the weight of the Text
colorstringyessets the color of the Text
paddingstringyessets a custom padding for the Text
marginstringyessets a custom margin for the Text
classNamestringyesadds custom styling via classes
childrenReactNodeyespasses children objects to the paragraph
fontSizestringyesalters the size of the font
TextWeight
PropPass as
regularstring
boldstring

Contributing

Contributions are always welcome. Feel free to fork the repository, create a new branch and start developing. For merging your contributions, please open a PR and explicitly add me as a reviewer. After carefully checking and resolving potential merge conflicts or any remarks, the contributions will be merged. A release cycle needs to be determined in due time, so any propositions are highly welcome as well.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Chris Schimetschka - LinkedIn - chris.schimetschka@kodebi.de

Project Link: https://github.com/kodebi/libkobei-ui

Acknowledgments

TBD

1.2.0

2 years ago

1.0.2

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.0.9

2 years ago

1.1.7

2 years ago

1.0.8

2 years ago

1.1.6

2 years ago

1.0.7

2 years ago

1.1.5

2 years ago

1.0.6

2 years ago

1.1.4

2 years ago

1.0.5

2 years ago

1.1.3

2 years ago

1.0.4

2 years ago

1.1.2

2 years ago

1.0.3

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.1

2 years ago

0.0.2

2 years ago

1.0.0

2 years ago