Skip to main content

Components

In this section you can learn how to install and implement the graphic components of the defactor library in your solutions.

UI Storybook

Check out our collection of react components for defactor user interfaces here: https://ui-kit.defactor.dev

Components API

In this section, you can see the API of each component

Button Component

Props

Props of the Button component are also available

NameTypeDefault valueDescription
variantstring-The variant of the button with 3 values: contained, outlined and text. (Required)
bgColorstring-The background color of the button. (Optional)
labelstring-The label of the button. (Optional)
colorstring-The color label of the button. (Optional)
disabledbooleanfalseIf true, the component is disabled. (Optional)
fontFamilystring-The font family of the button. (Optional)
fullWidthboolean-If true, the input will take up the full width of its container. (Optional)
borderColorstring-The color border of the button. (Optional)
externalStylesstring-The external custom styles of button. (Optional)
loaderReact Element or string-The loader of the button. (Optional)
iconReact Element or string-The icon of the button. (Optional)

You can interact with the component in the following link Button

Card Component

Props

Props of the Card component are also available

NameTypeDefault valueDescription
labelstring-The label of the card. (Required)
valuestring or number-The value of the card. (Required)
fluctuationstring-The fluctuation of the card. (Optional)
fluctuationValuestring-The fluctuationValue of the card. (Optional)
hoverBehaviorbooleanfalseIf true, the tooltip will work on hover in all the card. (Optional)
colorstring-The color of the point in the card. (Optional)
fontFamilystring-The font family of the card. (Optional)
externalStylesstring-The external custom styles of card. (Optional)
infoTooltipITooltip-The information of the tooltip in the card. (Optional)

You can interact with the component in the following link Card Component

Card Container

Props

Props of the Card Container are also available

NameTypeDefault valueDescription
contentReact Node-The content of the card. (Required)
handleMouseEnter((newValue: boolean) => void)-The function to run on mouse enter of the card. (Optional)
handleMouseLeave((newValue: boolean) => void)-The function to run on mouse leave of the card. (Optional)
isPointerboolean-If true, the mouse is displayed as a pointer. (Optional)
hoverBehaviorbooleanfalseIf true, the tooltip will work on hover in all the card. (Optional)

You can interact with the component in the following link Card Container

Collateral Section

Props

Props of the Collateral Section are also available

NameTypeDefault valueDescription
textCollateralstring-The text collateral of the collateral section. (Optional)
numberCollateralstring-The number collateral of the collateral section. (Optional)
textWalletstring-The text collateral of the collateral section. (Optional)
numberWalletstring-The number collateral of the collateral section. (Optional)
requiredSectionboolean-If true, is displayed the collateral required of the collateral section. (Required)
tokenSymbolstring-The token symbol displayed in the collateral section. (Optional)
walletIconReact Element or string-The wallet icon in the collateral section. (Optional)
fontFamilystring-The font family of the collateral section. (Optional)
backgroundColorstring#26A66B1AThe background color of the collateral section. (Optional)
loaderReact Element or string-The loader of the collateral section. (Optional)
tokenIconReact Element or string-The token icon of the collateral section. (Optional)

You can interact with the component in the following link Collateral Section

Container

Props

Props of the Container are also available

NameTypeDefault valueDescription
contentReact Node-The content of the container. (Required)
externalStylesstring-The external custom styles of container. (Optional)

You can interact with the component in the following link Container

Dashboard

Props

Props of the Dashboard are also available

NameTypeDefault valueDescription
colorsstring[]-The colors to represent the data. (Optional)
currencystring-The currency to display in the dashboard. (Required)
currencyIconReact Element or string-The currency icon to display in the dashboard. (Optional)
totalValueLockednumber or string-The total value locked to display in the dashboard. (Required)
titleGraphicstring-The title to display in the dashboard. (Required)
bottomLabelstring-The bottom label to display in the dashboard. (Required)
bottomIconReact Element or string-The bottom icon to display in the dashboard. (Optional)
bottomContainerItemsCardItem[][]The bottom information cards to display in the dashboard. (Optional)
rightLabelstring-The right label to display in the dashboard. (Required)
rightIconReact Element or string-The right icon to display in the dashboard. (Optional)
rightContainerItemsCardItem[][]The right information cards to display in the dashboard. (Optional)
fontFamilystring-The font family of the dashboard. (Optional)
contentReact Node-The content of the dashboard. (Required)

You can interact with the component in the following link Dashboard

Props

Props of the DropDown are also available

NameTypeDefault valueDescription
placeholderstring-The placeholder in the dropdown. (Required)
optionsstring[]-The options to display in the dropdown. (Required)
fontFamilystring-The font family of the dropdown. (Optional)
onChange(() => void)-The function to run by change of the dropdown. (Required)

You can interact with the component in the following link DropDown

Flat Container

Props

Props of the Flat Container are also available

NameTypeDefault valueDescription
contentReact Node-The content of the flat container. (Required)
externalStylesstring-The external custom styles of the flat container. (Optional)

You can interact with the component in the following link Flat Container

Informative Container

Props

Props of the Informative Container are also available

NameTypeDefault valueDescription
externalStylesstring-The external custom styles of the informative container. (Optional)
contentReact Node-The content of the informative container. (Required)
handleMouseEnter((newValue: boolean) => void)-The function to run on mouse enter of the informative container. (Optional)
handleMouseLeave((newValue: boolean) => void)-The function to run on mouse leave of the informative container. (Optional)
isPointerboolean-If true, the mouse is displayed as a pointer. (Optional)
hoverBehaviorbooleanfalseIf true, the tooltip will work on hover in all the informative container. (Optional)

You can interact with the component in the following link Informative Container

Input

Props

Props of the Input are also available

NameTypeDefault valueDescription
valueInputValue-The value of the input. (Required)
setFormatboolean-If true, set format of the input. (Optional)
typeHTMLInputTypeAttribute-The type of value of the input. (Optional)
onChange(e: ChangeEvent<HTMLInputElement>) => void-The function to run on change of the input. (Required)

You can interact with the component in the following link Input

Language Selector

Props

Props of the Language Selector are also available

NameTypeDefault valueDescription
localestring-The current language. (Required)
pathnameany-The pathname to update language page. (Required)
routerany-The router to update language page. (Required)
tany-The function to get translation page. (Required)
optionsOptionLanguage[]-The options language. (Required)
iconReact Element or string-The icon language selector button. (Optional)
activeIconReact Element or string-The active icon language selector on hover button. (Optional)
bgColorstring#057d2fThe background color of language selector options. (Optional)

You can interact with the component in the following link Language Selector

LendBorrow

Props

Props of the LendBorrow are also available

NameTypeDefault valueDescription
colorstring#26a66bThe color of button and tab selected. (Optional)
onLend() => void-The function to run on lend of LendBorrow . (Required)
onBorrow() => void-The function to run on borrow of LendBorrow . (Required)
bgColorstring-The background color of collateral section. (Optional)
walletSvgstring-The wallet icon of collateral section. (Required)
labelLendstring-The label of lend tab. (Required)
currentTabstring-The label of current tab. (Required)
disabledboolean-If true, the component is disabled. (Optional)
lendingSvgstring-The lending icon of lend borrow. (Required)
labelBorrowstring-The label of borrow tab. (Required)
textWalletstring-The text wallet of collateral section. (Optional)
fontFamilystring-The font family of the lend borrow. (Optional)
tokenSymbolstring-The token symbol displayed in the collateral section. (Optional)
borrowingSvgstring-The borrowing icon of borrow borrow. (Required)
textCollateralstring-The text collateral of collateral section. (Optional)
valuebigInt or InputValue-The value of lend borrow. (Required)
collateralBalancestring-The collateral balance of lend borrow. (Optional)
loaderReact Element or string-The loader of lend borrow. (Optional)
collateralRequiredstring-The amount collateral required of the collateral section. (Optional)
showRequiredCollateralbooleanfalseIf true, display of the amount collateral required of the collateral section. (Optional)
loaderCollateralReact Element or string-The loader of collateral section. (Optional)
tokenIconReact Element or string-The token icon of the collateral section. (Optional)
onChange() => void-The function to run on change of the input. (Required)
onChangeTab() => void-The function to run on change of tab. (Required)

You can interact with the component in the following link LendBorrow

Props

Props of the Modal are also available

NameTypeDefault valueDescription
contentReact Node-The content of the modal. (Required)
close() => void-The function to run on close of the modal. (Required)
isOpenboolean-If true, open the modal. (Required)
externalStylesstring-The external custom styles of the modal. (Required)

You can interact with the component in the following link Modal

Pill

Props

Props of the Pill are also available

NameTypeDefault valueDescription
labelReact Element or string-The label of the pill. (Required)
customBorderstring-The custom style of the border of the pill. (Optional)
colorstring-The color label of the pill. (Required)
bgColorstring-The background color of the pill. (Required)
fontFamilystring-The font family of the pill. (Optional)
externalStylesstring-The external custom styles of the pill. (Optional)

You can interact with the component in the following link Pill

Preview Profile

Props

Props of the Preview Profile are also available

NameTypeDefault valueDescription
labelstring-The label of the preview profile. (Optional)
imagestring-The image of the preview profile. (Optional)
bgColorstring-The background color of the preview profile. (Optional)
fontSizestring-The font size of the preview profile. (Optional)
imageSizestring-The image size of the preview profile. (Optional)
fontWeightstring-The font weight of the preview profile. (Optional)
fontFamilystring-The font family of the preview profile. (Optional)
imgChildReact Element or string-The image child of the preview profile. (Optional)

You can interact with the component in the following link Preview Profile

Props

Props of the SideBar are also available

NameTypeDefault valueDescription
menuOptionsReact Node-The content options of the sideBar. (Required)
externalStylesstring-The external custom styles of the sideBar. (Optional)

You can interact with the component in the following link SideBar

Small Profile

Props

Props of the Small Profile are also available

NameTypeDefault valueDescription
imagestring-The image of the small profile. (Optional)
iconstring-The icon of the small profile. (Optional)
sizestring-The size of the small profile. (Optional)
bgColorstring#F8F9FCThe background color of the small profile. (Optional)
imgChildReact Element or string-The image child of the small profile. (Optional)

You can interact with the component in the following link Small Profile

Table

Props

Props of the Table are also available

NameTypeDefault valueDescription
rowsIRowsObject[]-The rows of the table. (Required)
loadingboolean-If true, display the loading state of the table. (Optional)
fontFamilystring-The font family of the table. (Optional)
emptyTitlestring-The title to display if don't have data of the table. (Optional)
emptyDescriptionstring-The description to display if don't have data of the table. (Required)
emptyIconReact Node-The icon to display if don't have data of table. (Optional)
visiblePagenumber-The selected page of the table. (Optional)
haveOptionsboolean-If true, allow display options button of the table. (Optional)
headerbgColorstring-The background color on the header of the table. (Optional)
rowsHoverColorstringrgba(38, 166, 107, 0.1)
The background color on the rows on hover mouse of the table. (Optional)
totalRowsNumbernumber-The rows number of the table. (Required)
rowsNumberLabelstring-The label of rows number by page of the table. (Optional)
rowsPagenumber[]-The options of rows number by page of the table. (Optional)
rowsPageSelectednumber-The current rows number by page of the table. (Required)
headersIHeaderObject[]-The headers columns of the table. (Required)
filtersIFilterObject[]-The filter by column of the table. (Optional)
nextPage(motion: string) => void-The function on click next page button of the table. (Optional)
loaderComponentReact Node-The loader component of the table. (Optional)
handleSelectedPage(selectedValue: number) => void-The function to run on select page of the table. (Optional)
setFilters()=> void-The function to set the filters of the table. (Required)
handleSelectedRowsPage(selectedValue: string) => void-The function to run on select number rows of the table. (Required)

You can interact with the component in the following link Table

Tooltip

Props

Props of the Tooltip are also available

NameTypeDefault valueDescription
textstring-The text of the tooltip. (Required)
fontFamilystring-The font family of the tooltip. (Optional)
iconReact Element or string-The icon of the tooltip. (Optional)
activeIconReact Element or string-The active icon of the tooltip on hover. (Optional)
sizeIconnumber-The size icon of the tooltip . (Optional)
bgColorstring#26a66bThe background color of the tooltip. (Optional)
colorstring-The color label of the tooltip. (Optional)
openbooleanfalseThe state of the tooltip. (Optional)
positionstring-The position of the tooltip with 4 values: top, left, right, bottom. (Optional)
handleChange(newValue: boolean) => void-The function to run on change of the tooltip. (Required)

You can interact with the component in the following link Tooltip

Bar Chart

Props

Props of the Bar Chart are also available

NameTypeDefault valueDescription
formatValueFormatValueType-The function to format value of tooltip of the bar chart. (Optional)
seriesChartSeriesType[]-The data series of the bar chart. (Required)
colorsstring[]-The colors to represent the data of the bar chart. (Required)
datastring[]-The data of the bar chart. (Required)
dateFilterstring[]-The date filter to validate data of the bar chart. (Optional)
loadingboolean-If true, display the loading state of the bar chart. (Optional)
emptyTitlestring-The title to display if don't have data of the bar chart. (Optional)
emptyDescriptionstring-The description to display if don't have data of the bar chart. (Optional)
emptyIconReact Element or string-The icon to display if don't have data of the bar chart. (Optional)
colorstringwhiteThe color label of date filter of the bar chart. (Optional)
showXAxisbooleantrueIf true display the X Axis of the bar chart. (Optional)
filterBgColorstring#26a66bThe background color label of date filter of the bar chart. (Optional)
currentFilterstring-The value of date filter of the bar chart. (Optional)
formatValueVerticalFormatValueType-The function to format value of tooltip of the bar chart. (Optional)
handleChangeFilter(filter: string) => void)-The function to run on change of date filter of the the bar chart. (Optional)
displayDirectionstringhorizontalThe display direction of the bars values of the bar chart with 2 values: horizontal, vertical. (Optional)
formatValueAxisYFormatValueType-The function to format values on Y Axis of the bar chart. (Optional)
formatValueAxisXFormatValueType-The function to format values on X Axis of the bar chart. (Optional)
loaderComponentReact Node-The loader of the bar chart. (Optional)
formatDateFormatValueType-The function to format date of the bar chart. (Optional)
fontFamilystring-The font family of the bar chart. (Optional)

You can interact with the component in the following link Bar Chart

Line Chart

Props

Props of the Line Chart are also available

NameTypeDefault valueDescription
formatValueFormatValueType-The function to format value of tooltip of the line chart. (Optional)
seriesSeriesDataType[]-The data series of the line chart. (Required)
colorsstring[]-The colors to represent the data of the line chart. (Required)
dateFilterstring[]-The date filter to validate data of the line chart. (Optional)
loadingboolean-If true, display the loading state of the line chart. (Optional)
emptyTitlestring-The title to display if don't have data of the line chart. (Optional)
emptyDescriptionstring-The description to display if don't have data of the line chart. (Optional)
emptyIconReact Element or string-The icon to display if don't have data of the line chart. (Optional)
formatDateFormatValueType-The function to format date of the line chart. (Optional)
formatValueAxisXFormatValueType-The function to format values on X Axis of the line chart. (Optional)
formatValueAxisYFormatValueType-The function to format values on Y Axis of the line chart. (Optional)
handleChangeFilter(filter: string) => void)-The function to run on change of date filter of the the line chart. (Optional)
dataLineChartDataType[] or undefined-The data of the line chart. (Required)
filterBgColorstring#26a66bThe background color label of date filter of the line chart. (Optional)
currentFilterstring-The value of date filter of the line chart. (Optional)
colorstringwhiteThe color label of date filter of the line chart. (Optional)
loaderComponentReact Node-The loader of the line chart. (Optional)
fontFamilystring-The font family of the line chart. (Optional)

You can interact with the component in the following link Line Chart

Pie Chart

Props

Props of the Pie Chart are also available

NameTypeDefault valueDescription
dataPieDataType-The data of the pie chart. (Required)
loadingboolean-If true, display the loading state of the pie chart. (Optional)
emptyTitlestring-The title to display if don't have data of the pie chart. (Optional)
emptyDescriptionstring-The description to display if don't have data of the pie chart. (Optional)
emptyIconReact Element or string-The icon to display if don't have data of the pie chart. (Optional)
fontFamilystring-The font family of the pie chart. (Optional)
loaderComponentReact Node-The loader of the pie chart. (Optional)
formatValueFormatValueTypevalue => value.toLocaleString('en-US')The function to format value of tooltip of the pie chart. (Optional)
formatDateFormatValueType-The function to format date of the pie chart. (Optional)
formatValueAxisXFormatValueType-The function to format values on X Axis of the pie chart. (Optional)
formatValueAxisYFormatValueType-The function to format values on Y Axis of the pie chart. (Optional)

You can interact with the component in the following link Pie Chart

Follow us:

Copyright © 2024 Defactor. All Rights Reserved