0.0.11 • Published 5 years ago

droplr-react-ui v0.0.11

Weekly downloads
7
License
ISC
Repository
github
Last release
5 years ago

droplr-react-ui

A responsive UI library for React web applications.

Table of Contents

Buttons

Dropdowns

Forms

Library

Components

To use components you can import them like this (e.g. Button component):

import { Button } from 'droplr-react-ui';

Button

PropsDefaultProps notes
children - Stringempty stringThe text that will appear as a button's content.
type - String requiredThe button's visual type. Accepts primary and secondary.
buttonType - StringbuttonThe HTML button's type attribute. Accepts button, submit and reset.
Icon - React ComponentnullA React Component that will render a SVG icon.
onClick - Functionempty functionThe button's callback. A function that will be executed after a click event.
className - Stringempty stringThe button's additional class name.
disabled - BooleanfalseIf true, the button will appear in the disabled mode and will be unable to be clicked.
loading - BooleanfalseIf true, the button will appear in the loading mode and will be unable to be clicked.
maxWidth - BooleanfalseIf true, the button's width will increase to the 100% of it's container's width.
dropdown - BooleanfalseIf true, the button will appear with the dropdown icon on the right side.

DualButton

PropsDefaultProps notes
type - String'primary'The button's visual type. Accepts primary and secondary.
className - Stringempty stringThe button's additional class name.
maxWidth - BooleanfalseIf true, the button's width will increase to the 100% of it's container's width.
left - Object required {An object containing properties for the left button.
Icon - React ComponentnullA React Component that will render a SVG icon.
onClick - Functionempty functionThe button's callback. A function that will be executed after a click event.
className - Stringempty stringThe button's additional class name.
disabled - BooleanfalseIf true, the button will appear in the disabled mode and will be unable to be clicked.
loading - BooleanfalseIf true, the button will appear in the loading mode and will be unable to be clicked.
maxWidth - BooleanmaxWidthIf true, the button's width will increase to the 100% of it's container's width.
dropdown - BooleanfalseIf true, the button will appear with the dropdown icon on the right side.
text - Stringempty stringThe text that will appear as a button's content.
}
right - Object required {An object containing properties for the right button.
Icon - React ComponentnullA React Component that will render a SVG icon.
onClick - Functionempty functionThe button's callback. A function that will be executed after a click event.
className - Stringempty stringThe button's additional class name.
disabled - BooleanfalseIf true, the button will appear in the disabled mode and will be unable to be clicked.
loading - BooleanfalseIf true, the button will appear in the loading mode and will be unable to be clicked.
maxWidth - BooleanmaxWidthIf true, the button's width will increase to the 100% of it's container's width.
dropdown - BooleanfalseIf true, the button will appear with the dropdown icon on the right side.
text - Stringempty stringThe text that will appear as a button's content.
}

DropdownItem

PropsDefaultProps notes
title - String requiredThe text displayed in the dropdown item.
TitleIcon - React ComponentnullAn icon displayed after the title.
description - Node elementempty stringDescription displayed under the title.
Icon - React ComponentnullAn icon displayed before the title.
className - Stringempty stringDropdown item's additional class name.
active - BooleanfalseIndicates that the item is active with a check mark. Works only with showItemStatus = true.
onClick - Functionempty functionA function that will be executed after a click event.
href - Stringempty stringMakes the dropdown item a link and uses passed prop as a href attribute.
target - Stringempty stringPasses the prop to the element's target attribute.
showItemStatus - BooleanfalseIf true, will display the check mark inside the dropdown item that has a prop active set to true.
disabled - BooleanfalseIf true, the dropdown item will appear in the disabled mode and will be unable to interact with.
closeDropdown - Functionempty functionA function that will close the dropdown.
closeOnItemClick - BooleanfalseIf true, will trigger the function from the closeDropdown prop after clicking on the item.

Dropdown

PropsDefaultProps notes
isActive - Boolean requiredIf true, it shows up itself. Hidden when false.
children - Node ElementElements or components that will be displayed as dropdown items.
or array of Node Elements
or Function
or array of Functions
header - Stringempty stringThe text displayed at the top of the dropdown.
className - Stringempty stringDropdown's additional class name.
showItemStatus - BooleanfalseIf true, will display the check mark inside the dropdown item that has a prop active set to true.
close - Functionempty functionA function that will close the dropdown.
closeOnItemClick - BooleanfalseIf true, will trigger the function from the close prop after clicking on the item.
onMouseLeave - Functionempty functionFunction that will be executed when mouse leaves the dropdown component

DropdownWithToggler

PropsDefaultProps notes
Toggler - React Component requiredA component that will display as dropdown toggler, e.g. a button.
onClick - Functionempty functionA function that will be executed after a click event is fired on the toggler.
header - Stringempty functionCallback function on onMouseLeave event.
className - Stringempty stringDropdownWithToggler's additional class name.
isActive - BooleanfalseIf true, the dropdown will be open after the component mounts.
closeOnItemClick - BooleanfalseIf true, the dropdown will close after clicking on a dropdown item.
showItemStatus - BooleanfalseIf true, the dropdown will display the check mark inside the dropdown item that has a prop active set to true.
closeOnMouseLeave - BooleanfalseDropdown will be closed when mouse leaves it.
onMouseLeave - FunctionfalseDropdown will be closed when mouse leaves it.
children - Node Element requiredElements or components that will be displayed as dropdown items.
or array of Node Elements
or Function
or array of Functions
setRef - Functionempty functionA function that should set a reference to a custom container if we want the dropdown to position itself in reference to it instead of the window.

Input

PropsDefaultProps notes
name - String requiredInput's name attribute.
className - Stringempty stringInput's additional class name.
type - String'text'Input's type attribute.
value - Stringempty stringInput's value attribute.
placeholder - Stringempty stringInput's placeholder attribute.
label - Stringempty stringInput's label text.
sublabel - Stringempty stringInput's sublabel text.
info - Stringempty stringInput's description displayed as a text paragraph under the input.
error - Stringempty stringInput's validation error message.
autoFocus - BooleanfalseInput's autoFocus attribute.
readOnly - BooleanfalseIf true, the input will appear in the read-only mode, allowing only to read and copy the input's value.
disabled - BooleanfalseIf true, the input will appear in the disabled mode and will be unable to interact with.
passwordVisibilityToggle - BooleanfalseIf true, adds a button inside the input to toggle the password's visibility. Works only if type = 'password'.
passwordVisible - BooleanfalseIf true, the password input's value will render as visible.
onBlur - Functionempty functionA function that will be executed after input's onBlur event triggers.
onFocus - Functionempty functionA function that will be executed after input's onFocus event triggers.
onKeyPress - Functionempty functionA function that will be executed after input's onKeyPress event triggers.
onChange - Functionempty functionA function that will be executed after input's onChange event triggers.

Switch

PropsDefaultProps notes
label - Stringempty stringSwitch'es label text.
labelPosition - String'left'The switch'es label position. Accepts top, right, bottom and left.
checked - BooleanfalseThe switch'es visual state. If true, it will appear as checked / active.
disabled - BooleanfalseIf true, the switch will appear in the disabled mode and will be unable to be clicked.
onChange - Functionempty functionA function that will be executed after input's onChange event triggers.
className - Stringempty stringThe switch'es additional class name.

Icons

To use icons you can import them like this (e.g. DownloadIcon):

import { DownloadIcon } from 'droplr-react-ui/icons';

Storybook

The storybook contains all of the components in different states and all of the icons. It helps you to understand how they work and how to use them.

To use our Storybook you can run it with this command:

npm run storybook
0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago