1.0.0 • Published 3 years ago

react-components-hvc v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

React Components

A React component library for faster development

The available components are : 1. Avatar 2. Button 3. Loader 4. Menu 5. Pagination 6. Snackbar 7. Stack 8. Table 9. Tooltip

Avatar

Usage

Props

NameTypeDefaultDescription
imgSrcstringThe src for image avatar
initialLengthnumber (1 | 2)1The length of initials on avatar
namestringThe name of the person
sizenumber56The size of avatar in px
variant*'image' |'initial''initial'The type of avatar

Button

Usage

Props

NameTypeDefaultDescription
children*ReactNode | string
clickHandlerfunctionCallback fired on click
disabledbooleanfalse
variant'icon'For icon button

Loader

Usage

Props

NameTypeDefaultDescription
backgroundstring
colorstring
loading*booleanDetermines loader visibility
sizenumberSize in pixels

Menu

Usage

Props

NameTypeDefaultDescription
classes{ menu?: string button?: string list?: string item?: string }Class map for menu components
menuButton*ReactNode | stringThe children for Menu Button component
menuItems*Array\<{children: ReactNode | string, clickHandler: function}>Array of items constituting the menu
horizontal*'left' | 'center'| 'right''left'Horizontal position for menu
vertical*'bottom' | 'center' | 'top''bottom'Vertical position for menu
horizontalOffsetnumberHorizontal offset in px
verticalOffsetnumberVertical offset in px

Pagination

Usage

Props

NameTypeDefaultDescription
changePage*(page: number) => voidFunction to update current page
classes{ root?: string, arrowButton?: string, pageButton?: string, dots?: string }Class map for Pagination components

| currentPage | number | | Active page number | | pageCount | number | | Total number of pages | | siblingCount | number | 1 | Minimum number of page buttons show on either side of the active page |

Snackbar

Usage

Props

NameTypeDefaultDescription
durationnumber3000Number of milliseconds snackbar appears on screen
imgSrcstringThe src for icon
label*stringLabel on the snackbar
variant'success' | 'error''error'

Stack

Usage

Props

NameTypeDefaultDescription
childrenReactNode
direction'row' | 'column''row'
columnSpacingnumber1Space between columns in rem
rowSpacingnumber1Space between rows in rem
wrapbooleanfalse

Table

Usage

Props

NameTypeDefaultDescription
classes{ table?: string header?: string headerCell?: string row?: string cell?: string }Class map for table components
header*Array\<{title: string, selector: string}>Data displayed on table header
rows*Array\<{ }>Data displayed on table body

Tooltip

Usage

Props

NameTypeDefaultDescription
backgroundstring
childrenReactNode
classes{wrapper?: string, text?: string}Class map for tooltip wrapper and text
colorstring
direction*'top' | 'right' | 'bottom' | 'left''top'
title*string