0.1.8 • Published 3 years ago

@dylc/dylc-ui v0.1.8

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

UI-React-Elements

Table of Contents


Examples


List of UI elements

Button

Examples

Simple button with nice onHover effect

Config

ValueOptionalTypeDescriptionExampleMore
title-stringtitle of the buttontitel="Click me"
borderVboolean or border as cssborder, if none - use don't use. just border will use defaultborder, border="0.5px solid #D5DFE9!important"

Usage

Import

  import { Button } from '@dylc/dylc-ui';
  1. Minimnal Configuration
  <Button title="Click me" />
  1. Minimnal Configuration with border
  <Button title="Click me" border />
  1. Minimnal Configuration with custom border
  <Button title="Click me" border="0.5px solid #D5DFE9!important" />

DoubleButton

Examples

The button that consist of 2 parts - one is regular button and another one (default is icon buttpon with drop down arrow) Any of the buttons are accept all values from material

Config

ValueOptionalTypeDescriptionExampleMore
mainButtonTitle-stringtitle of the main buttonmainButtonTitle="Click me"
mainButtonOnClickHandlerVfunctionhandler of the main buttonmainButtonOnClickHandler={onClickHandler}
secButtonOnClickHandlerVfunctionhandler of the secondary button - will be used only if no children passedsecButtonOnClickHandler={onClickHandler}
childrenVReact Element(s)the children is the content of the popper once secondaty button has been clicked<h3 style={{ margin: 8 }}> Hello there </h3>has any ts type
borderRadiusVnumberborder radius applied to outer button groupborderRadius={12}default is 4
buttonGroupPropsVButtonGroupPropsprops from material Button groupbuttonGroupProps={{}}Button Group API
mainButtonPropsVButtonPropsprops from material ButtonmainButtonProps={{}}Button API
secButtonPropsVButtonPropsprops from material ButtonsecButtonProps={{}}Button API
fadePropsVFadePropsprops from material Fade elementfadeProps={{}}Fade API
popperPropsVPopperPropsprops from material PopperpopperProps={{}}Popper API
paperPropsVPaperPropsprops from material PaperpaperProps={{}}Paper API
secButtonTitleVstring or material-iconCan be string or any icon. Default is drop down arrow iconbuttonGroupProps={{}}

Usage

Import

  import { DoubleButton } from '@dylc/dylc-ui';
  1. Minimnal Configuration
  <DoubleButton mainButtonTitle="Merge" />
  1. With custom events for main and secondary buttons
  // important NOT to pass children
  // e.g DO NOT <DoubleButton ...> </DoubleButton >
  <DoubleButton 
    mainButtonTitle="Merge"
    mainButtonOnClickHandler={mainButtonOnClickHandler}
    secButtonOnClickHandler={secButtonOnClickHandler}
  />
  1. To use default handler for secondary button
  // important to pass children
  // it will be rendered on sec.but. handler
  <DoubleButton 
    mainButtonTitle="Merge"
    mainButtonOnClickHandler={mainButtonOnClickHandler}
  > 
    <h4> See me on secondary button click </h4>
  </DoubleButton> 
  1. To use custom material icon for sec.button
  // important to pass children
  // it will be rendered on sec.but. handler

  import AddIcon from '@material-ui/icons/Add';

  <DoubleButton 
    mainButtonTitle="Merge"
    mainButtonOnClickHandler={mainButtonOnClickHandler}
    secButtonTitle={<AddIcon/>} // or use string
  > 
    <h4> See me on secondary button click </h4>
  </DoubleButton> 

Switch

Examples

Switch/Toggle with multiply choices

Config

ValueOptionalTypeDescriptionExampleMore
items-[{label: string, handler: any}]Array of Items where every item is an object with label and handler (the latest is a function). The can be more than 2 itemsitems: [{label: 'Start',handler: () => {console.log('Start')}},{label: 'End', handler: () => {console.log('End')}}]
selectedVnumberdefault selected value (from 0) - the default is 0selected: 1

Usage

Import

  import { Switch } from '@dylc/dylc-ui';
  1. Minimnal Configuration
  <Swicth 
    items={[
      {
        label: 'Start',
        handler: () => {console.log('Start')}
      },
      {
        label: 'End',
        handler: () => {console.log('End')}
      }
    ]} 
  />
  1. Minimnal Configuration for 3
  <Swicth 
    items={[
      {
        label: 'First',
        handler: () => {console.log('First')}
      },
      {
        label: 'Second',
        handler: () => {console.log('Second')}
      },
      {
        label: 'Third',
        handler: () => {console.log('Third')}
      }
    ]} 
  />
  1. Minimnal Configuration with default selected 1
  <Swicth 
    items={[
      {
        label: 'Start',
        handler: () => {console.log('Start')}
      },
      {
        label: 'End',
        handler: () => {console.log('End')}
      }
    ]}
    selected={1} 
  />