1.0.5 • Published 4 years ago

@liquid-design/liquid-design-react-native v1.0.5

Weekly downloads
1
License
SEE LICENSE IN LI...
Repository
-
Last release
4 years ago

Liquid-Design-System React Native

Gitter chat

Liquid Design System components for React Native. Design System and Component Kit to create beautifull applications.

Terms of Use

see TERMS_OF_USE.md

Please note that the security of the platform/project at which you are using Liquid Design System, or parts of it, are not the responsibility of the providers of this design system.

Installation

This library depends on 3 other libraries: react-native-svg, react-native-vector-icons and react-native-view-overflow. To use @liquid-design/liquid-design-react-native, please make sure that you have the other libraries added and linked correctly:

After installing the abovementioned libraries, please continue with:

npm install --save @liquid-design/liquid-design-react-native

or

yarn add @liquid-design/liquid-design-react-native

To link native dependencies after instalation run

react-native link

More details about linking libraries: LINKING.md

Usage

Import the component you need to use it.

import React, { Component } from 'react'

import { Bubble } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Bubble/>
    )
  }
}

Theming

Some components have themeName prop in which you can pass one of themes to use with the library. Themes list: vibrantCyan, richBlue, richPurple, vibrantMagenta. The default theme is vibrantCyan.

import React, { Component } from 'react'

import { GhostButton } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <GhostButton themeName='vibrantMagenta' />
    )
  }
}

If you want to use your custom theme you can pass object instead of theme name. Custom theme should be an object with a specific shape passed as ThemeName prop.

import React, { Component } from 'react'

import { GhostButton } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  const customTheme = {
    primary: {                      // overrides primary theme colors
      lightest: '#A5A5E6',
      light: '#A5A5E6',
      base: '#6767EF',
      dark: '#22226D',
      darker: '#3737A2',
    },
    secondary: {                    // overrides secondary theme colors
      lightest: '#D4F5EF',
      light: '#A5A5E6',
      base: '#31F3CF',
      dark: '#03FFD1'
      darker: '#3737A2',
    }
  }

  render() {
    return (
      <GhostButton themeName={customTheme} />
    )
  }

Prerequisites

API Reference

This README will be updated before making library public.

Elements

Bowls

Bowls are graphic elements with fancy animation on changing value.

import React, { Component } from 'react'

import { Bowl, Slider } from '@liquid-design/liquid-design-react-native'

class Example extends Component {
  state = {
    H: 0
  }

  render() {
    return (
      <Bowl H={this.state.H} />
      <Slider onSlidingComplete={val => this.setState({ H: val })}
    )
  }
}

Available Props

PropTypeDefaultDescription
Hnumber(isRequiredHeight of the waves inside Bowl - animation is on changing this value.
loopedboolfalseIf set to true will loop animation.

Bubbles

Bubbles are notifications that indicate new available information at the data categorie’s respective link or icon.

Use bubbles as temporary and dynamic elements that adapt to new information and not as a static element. Indicators need to be used respective to the kind of available data.

import React, { Component } from 'react'

import { Bubble } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Bubble />
    )
  }
}

Available Props

PropTypeDefaultDescription
alignItemsstring'center'Align the Component on the Y axis.
backgroundColorstring'primary'Main color of the Component.
borderRadiusnumber50Border Radius of a Component. May needed to be changed when size is changed.
colorstring'white'Color of the Component's content element.
disabledboolfalseDisable / enable Component.
fontSizenumber3Font size of a Component content. 3 is the index number of fontSize from the theme file, where all the font sizes are declared.
fontWeightnumber6Weight of a Component content. 3 is the index number of font weight from the theme file, where all the font weights are declared
justifyContentstring'center'Style of Component on the X axis.
sizenumber30Size of the Component.
iconSizenumber14Size of the Icon inside the Bubble.
warningboolfalseStyle for Component in warning state.
textAlignstring'center'Align of element inside Component.

Buttons

Buttons, or call-to-actions (CTAs) are used for important user actions. Button labels should be speaking in the sense of the user’s understanding, rather than in the system’s language. Buttons can be combined with each other, but only within their label-groups (i.e. Text, Icon, Text & Icon).

Primary Button

Use primary buttons for high prioritized interactions as they should guide the user. Use only as stand-alone or in combination with secondary or ghost buttons.

Secondary Button

Use secondary buttons for low prioritized interactions that need to be available for the user (e.g. Back, Cancel). Use only in combination with primary or highlight buttons.

Highlight Button

Use highlight buttons for very high prioritized interactions as they draw a lot of attention from the user. Use as stand-alone or in combination with secondary buttons. Confirmations need to be labelled “Okay Cool”.

Ghost Button

Use ghost buttons for very low prioritized interactions as they draw little attention from the user. Use only in combination with other ghost buttons or primary buttons.

import React, { Component } from 'react'

import { Button } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Button
        Big
        highlight
        icon={{
          name: 'placeholder'
          size: 24,
          color: 'black'
        }}
      />
    )
  }
}
import React, { Component } from 'react'

import { GhostButton } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <GhostButton />
    )
  }
}

Available Button Props

PropTypeDefaultDescription
iconobject{}Icon configuration for button with icon or button with icon on the left (name from the Merck Icon library).
buttonStyleobject{}Style of the Button container.
titleStyleobject{}Style of the Button title.
iconLeftboolfalseDisplay icon on the left (available only with defined icon configuration).
highlightboolfalseDisplay Highlight Button.
secondaryboolfalseDisplay Secondary Button.
titlestringTextText of the Button label.
onPressfuncFunction which triggers after Button pressed.
disabledboolfalseDisable Button.
BigboolfalseMake Button bigger.
borderRadiusnumber6Border radius of the Button.
colorstring#ffffffColor of the title.
fontSizenumber16Font Size of the title.
fontFamilystringLato-BlackFont Family of the title.
activeboolfalseActive Button state.
widthnumber100Width of the Button container.
heightnumber40Height of the Button container.

Available Ghost Button Props

PropTypeDefaultDescription
onPressfuncfalseFunction which triggers after Ghost Button pressed.
BigboolfalseMake Button bigger.
titlestringTextTitle of the Ghost Button.
disabledboolfalseDisable Ghost Button.
fontSizenumber14Font Size of the title.
fontFamilystringLato-RegularFont Family of the title.
titleStyleobjectStyle of the title.
activeboolfalseActive state of Ghost Button.
colorstring#2dbecdColor of the title.
fontWeightnumber/stringnormalFont Weight of the title.
titleIconWrapperStyleobject{ width: 40, marginRight: 5, marginLeft: 5}Style of the title with icon.
containerStyleobject{ width: 70, height: 30Style of the Ghost Button container.
iconobject{}Icon configuration for Ghost Button with icon on the left or Ghost Button with icon on the right (name from the Merck Icon library).
iconLeftboolfalseDisplay icon on the left.
iconRightboolfalseDisplay icon on the right.

Cards

Cards can be used as an entrance to a category within the content or as bold links, for example on a dashboard interface. As cards have a resemblance with physical cards, it is important to stay close to the real behavior in terms of their haptics and movements.

import React, { Component } from 'react'

import { Card } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Card />
    )
  }
}

Available Props

PropTypeDefaultDescription
alignItemsstring'center'Align the Component on the Y axis.
backgroundColorstring'primary'Main color of the Component.
borderRadiusnumber50Border Radius of a Component.
contentAlignItemsstring'center'Align the Component's content on the Y axis.
contentHeightstring92%Height of Component's content.
contentWidthstring92%Width of Component's content.
heightnumber | Height of a Component.
widthnumber | Width of a Component.
infoboolfalseStyle for Component in Info state .
justifyContentstring'center'Style of Component on the X axis.
stackedboolfalseShow a stacked Component.

Checkboxes

Checkboxes are used to select one or multiple options from a set of available values.

import React, { Component } from 'react'

import { Checkbox } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Checkbox checked={false} />
    )
  }
}

Available Props

PropTypeDefaultDescription
disabledboolfalseDisable Checkbox.
checkedboolDetermines when Checkbox is checked.
onPressfuncFunction called when Checkbox is pressed.
titlestringCheckbox textTitle of the Checkbox.
fontFamilystringLato-RegularFont Family of the title.
fontWeightnumber100Font Weight of the title.
fontSizenumber18Font Size of the title.
iconSizenumber30Size of the icon.
titleStyleobject{ color: #1b1b25 }Style of the title.
iconColorstring#2dbecdColor of The icon.
titleContainerStyleobject{}Style of the title container.
iconContainerStyleobject{}Style of the icon container.

Favorites

Favorite is an icon of heart shape with animation on tap which can be used as like/unlike button.

import React, { Component } from 'react'

import { Favorite } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Favorite
        activeColor='#f3f3f3'
      />
    )
  }
}

Available Props

PropTypeDefaultDescription
primaryboolfalseDetermines when default is displayed.
activeboolfalseDetermines when active is displayed.
disabledboolfalseDetermines when disabled is displayed.
colorstring#e9e9edColor of inactive (default) favorite.
activeColorstring#e61e50Color of active favorite.
durationnumber525Duration of the favorite animation.
onPressfunc() => {}Function called when favorite is pressed.

Dropdowns

Dropdowns or select fields enable the user to select one option from a list of multiple options. The selection of an option can affect other form elements on the same page / screen.

import React, { Component } from 'react'

import { Dropdown } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Dropdown
        inline
        multiSelect
      />
    )
  }
}

Available Props

PropTypeDefaultDescription
inlineMultiselectDropdownStyleobject{}Style of the inline, multiselect Dropdown. Valid only if 'inline' and 'multiSelect' are true.
inlineMultiSelectContainerStyleobject{}Style of the inline,multiselect container. Valid only if 'inline' and 'multiSelect' are true.
inlineDropdownContainerStyleobject{}Style of the inline container. Valid only if 'inline' is true.
dropdownContainerStyleobject{}Style of the default Dropdown container.
onOptionPressfuncFunction called after option from list is pressed.
inlineboolfalseDetermines when the Dropdown is inline.
multiSelectboolfalseDetermines when Dropdown display multiselect rows.
dropdownLabelstringDropdown LabelLabel of the Dropdown.
iconColorstring#2dbecdColor of the right arrow icon.
disabledboolfalseDetermines when Dropdown is disabled.
fontFamilystringLato-RegularFont Family of the Dropdown Label.
fontSizenumber16Font Size of the Dropdown Label.
optionsarray{}Array of items for the Dropdown.
inlineMultiselectRowStyleobject{}Style of the Inline Multiselect Dropdown row.
dropdownStyleobject{}Style of the default Dropdown list.
inlineDropdownStyleobject{}Style of the Inline Dropdown list.
rowStyleobject{}Style of Default Dropdown row.
inlineRowStyleobject{}Style of Inline Dropdown row.
multiSelectIconStyleobject{}Style of the Multiselect Icon.
labelStyleobject{}Style of the Dropdown label.
rowTitleStyleobject{}Style of the row title.
dropdownShadowobject{}Style of Dropdown list shadow (Available only on iOS).

Filters

Filters are used to organize a set of available content by categories. They should always be used close to their content. Filters can be added and removed in order to decrease or increase the amount of visible content.

Filters need to consist of a label and the filter icon. The selected option is displayed as a tag and replaces the label once selected.

import React, { Component } from 'react'

import { Filter } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    const options = ["Option 1", "Option 2", "Option 3"]

    return (
      <Filter options={options} />
    )
  }
}

Available Props

PropTypeDefaultDescription
disabledboolfalseBoolean for disabling the Filter.
multiSelectboolfalseBoolean for enabling multi selection in options of the filter.
filterPrimaryColorstring#2dbecdMain color for filter.
filterSecondaryColorstring#f3f3f7Secondary color for the filter.
filterDisabledColorstring#d5d5d9Color for the disabled filter.
filterContainerHeightnumber25Height of the filter container.
filterIconSizenumber10Size of the icon size.
filterLabelstringFilter LabelName for a filter.
dropdownShadowobject-Style for shadow on a dropdown. iOS only
optionsarray-Array of items for the dropdown.
dropdownPositionRightboolfalseProperty to position dropdown to the right of the filter.

Headlines

Headlines are used as an introduction into a topic and for visual differentiation between content blocks. Headlines require hierarchies and a placement conform with these.

import React, { Component } from 'react'

import { Headline } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Headline type='H1' />
    )
  }
}

Available Props

PropTypeDefaultDescription
typestringtype of the Headline Component. Could be: XH5 - Font Size of 40px, XH6 - Font Size of 36px, H1 - Font Size of 32px, H2 - Font Size of 26px, H3 - Font Size of 22px, H4 - Font Size of 18px, H5 - Font Size of 16px, H6 - Font Size of 14px, B1 - Font Size of 48px,Merck Font Family, B2 - Font Size of 40px,Merck Font Family, B3 - Font Size of 36px,Merck Font Family, B4 - Font Size of 32px,Merck Font Family, B5 - Font Size of 26px,Merck Font Family, B6 - Font Size of 26px,Merck Font Family
textStyleobject{}Style of the Headline.
colorstring#1b1b25Color of the Headline.
fontSizenumber14Font Size of the Headline.
fontFamilystringLato-BlackFont Family of the Headline.
lineHeightnumber14Height of the line.

Icons

Icon is a component used to display icon from icon set.

import React, { Component } from 'react'

import { Icon } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Icon
        name='closingX'
        size={30}
      />
    )
  }
}

Available Props

PropTypeDefaultDescription
namestringhomeDetermines which icon is displayed.
sizenumber24Size of the icon.
colorstring#2dbecdColor of the icon.

Links

Links are hyperlinks that point at (target) any domain. There are two ways to add Link component - default and with any Paragraph (Link will display with text of the Paragraph).

import React, { Component } from 'react'

import { Link, Paragraph } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Link
        text='Test'
        source='http://merck.design'
        active
      />
      <Paragraph
        Small
        text='Example paragraph'
        withLink
        linkText='Read more'
        source='http://merck.design'
      />
    )
  }
}

Available Props

PropTypeDefaultDescription
textstring(isRequired)Link text.
sourcestring(isRequired)Source of the link.
colorstring#2dbecdColor of the link.
fontSizenumber16Font size of the link.
fontFamilystringLato RegularFont family of the link.
fontWeightnumberFont weight of the link.
activeboolfalseDetermines when active link is displayed.
withLinkboolfalseDetermines when link with Paragraph is displayed.
linkTextstring(isRequired)Link text in Paragraph.

Lists

Lists are used to vertically organize content. Lists can be ordered or unordered. Unordered lists can also be used as checklists.

import React, { Component } from 'react'

import { List, ListItem, ListHeader } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  renderRow = ({ item }) => (
    <ListItem
      title={item.title}
    />
  )

  renderHeader = () => (
    <ListHeader />
  )

  render() {
    return (
      <List
        data={data}
        renderRow={this.renderRow}
        renderHeader={this.renderHeader}
      />
    )
  }
}

Available List Props

PropTypeDefaultDescription
dataarrayArray of data displayed on the List.
renderRowfuncFunction which renders List rows.
renderHeaderfuncFunction which renders List header.
listContainerStyleobject{}Style of the List container.
renderSeparatorfuncFunction which renders List separator.

Available List Item Props

PropTypeDefaultDescription
onPressfuncFunction called after Item pressed.
titlestringTitle of the Item.
iconobjectIcon configuration for Item (name from the Merck Icon library).
iconLeftboolfalseDisplay Icon on the left. Valid only if icon object provided.
disabledboolfalseDetermines when Item is disabled.
activeboolfalseDetermines when Item is active.
containerStyleobject{ height: 50, width: 300,alignItems: 'center' }Style of the Item container.
titleStyleobject{ fontSize: 14 }Style of the title.
titleColorstring#1b1b25Color of thetTitle.
titleActiveColorstring#2dbecdColor of the title when Item is pressed/active.
titleActiveFontFamilystringLato-BlackFont Family of the title when Item is pressed/active.
titleFontFamilystringLato-RegularFont Family of the title.
containerBackgroundColorstring#f8f8fcBackground Color of the container.
containerBackgroundColorActivestring#f3f3f7Background Color of the active container.

Available List Header Props

PropTypeDefaultDescription
onPressfuncFunction called after Header pressed.
bottomSeparatorfuncFunction which render bottom separator of the Header.
titlestringList Head 01Title of the Header.
iconobjectIcon configuration for Header (name from the Merck Icon library).
iconLeftboolfalseDisplay Icon on the left. Valid only if icon object provided.
containerStyleobject, array{}Style of the Item container.
titleStyleobject, array{}Style of the title.
titleFontSizenumber16Font Size of the title.
titleFontFamilystringLato-BlackFont Family of the title.
titleColorstring#1b1b25Color of the title.
containerWidthnumber300Width of the Container.
containerHeightnumber50Height of the Container.

Logos

Information on the usage of our logo can be found in the brand principles document which can be requested from our branding department at branding@merckgroup.com.

import React, { Component } from 'react'

import { Logo } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
     <Logo/>
    )
  }
}

Available Props

PropTypeDefaultDescription
colorstring#503291Color of the Logo.
sizenumber90Size of the Logo.
styleobject, array{}Style of the Logo.

Paragraphs

Paragraphs are rich text blocks. The text can be formatted.

import React, { Component } from 'react'

import { Paragraph } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Paragraph type='XLarge' />
    )
  }
}

Available Props

PropTypeDefaultDescription
typestringtype of Paragraph component. One of: XLarge - Font Size of 22px, Large - Font Size of 18px, Medium - Font Size of 16px, Small - Font Size of 14px, XSmall - Font Size of 12px, Label - Font Size of 16px, XLabel - Font Size of 12px.
textStyleobject{}Style of the Paragraph.
colorstring#1b1b25Color of the Paragraph.
fontSizenumber12Font Size of the Paragraph.
fontWeightnumber400Font Weight of the Paragraph.
fontFamilystringLato-RegularFont Family of the Paragraph.
letterSpacingnumber0Letter Spacing of the Paragraph.

Placeholders

Placeholders display graphic elements - available in 3 shapes (circle by default, square, rectangle).

import React, { Component } from 'react'

import { Placeholder } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Placeholder isSquare />
    )
  }
}

Available Props

PropTypeDefaultDescription
widthnumber300Width of the placeholder element.
heightnumber300Height of the placeholder element.
isSquareboolfalseIf set to true will display squared placeholder.
isRectangularboolfalseIf set to true will display rectangular placeholder.

Radio Buttons

Radio buttons are used to select one option out of a set of multiple options.

import React, { Component } from 'react'

import { RadioButton } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <RadioButton selected={false} />
    )
  }
}

Available Props

PropTypeDefaultDescription
disabledboolfalseDisable Radio Button.
onPressfuncFunction called after Radio Button pressed.
titlestringRadio Button LabelTitle of the Radio Button.
fontFamilystringLato-RegularFont Family of the Radio Button.
fontWeightnumber100Font Weight of the Radio Button.
fontSizenumber14Font Size of the Radio Button.
iconSizenumber24Size of the Radio Button Icon.
titleStyleobject{ color: #1b1b25 }Style of the title.
titleContainerStyleobject{}Style of the title container.
iconContainerStyleobject{}Style of the icon container.
iconColorstring#2dbecdColor of the Radio Button icon.

Tags

Tags are used for labeling items or content. Tags may also be used as a display for active filters.

import React, { Component } from 'react'

import { Tag } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Tag />
    )
  }
}

Available Props

PropTypeDefaultDescription
onPressfunc-OnPress Function to pass to Tag.
textstring'Tag Label'Main color of the Component.
borderRadiusnumber16Border Radius of a Component.
borderWidthnumber'1.5'Width of Tag border.
fontFamilystringLato-BlackFont family of a Tag.
fontSizenumber12Font Size of a font family.
disabledColorstring#e9e9edColor of disabled tag.
outlineboolfalseBoolean for outline style of a Tag .
disabledboolfalseBoolean for disabled style of a Tag .
colorstring'white'Color of text inside Tag.
tagColorboolfalseColor of Tag background and outline tag..
widthnumberfalseWidth of the Tag.
heightnumberfalseHeight of a Tag.

Text Fields

Text fields are used either in forms together with other input fields or stand-alone (e.g. value entering, newsletter etc.), for submitting data. Text field types should always be aligned with their use case (e.g. calendar, e-mail etc.). Error messages are required and should appear as quickly as possible. Error messages should describe the issue as specific as possible.

import React, { Component } from 'react'

import { TextField } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  state={
    error: false
  }

  render() {
    return (
      <TextField
        error={this.state.error}
        multiline
      />
    )
  }
}

Available Props

PropTypeDefaultDescription
wrapperWidthnumber300Width of the single line Text Field.
wrapperHeightnumber40Height of the single line Text Field.
multilineWrapperWidthnumber300Width of the multiline Text Field (Valid if multiline prop is true).
multilineWrapperHeightnumber200Height of the multiline Text Field (Valid if multiline prop is true).
errorMessageFontSizenumber12Font Size of the error message.
bothTypesWrapperStyleobejct, array{ paddingLeft: 15 }Style for both types of Text Field Wrapper.
errorMessageFontFamilystringLato-RegularFont Family of the error message.
errorMessageColorstring#e61e50Color of the error message.
disabledboolfalseDisable Text Field.
errorboolDetermines when error is displayed.
errorMessagestringError MessageError Message.
placeholderstringAdd Placeholder Text herePlaceholder of the Text Input.
placeholderTextColorstring#a4a4aeColor of the placeholder.
onFocusfuncFunction Called when Text Field is focused.
onBlurfuncFunction Called when Text Field is blurred.
errorMessageStyleobject{}Style of the error message.
multilineboolfalseDetermines if Text Field is multiline.
backgroundColorstringtransparentBackground Color of the Text Input.
textInputLabelstring'Text Area label'Text of the Text Input label.
textInputLabelColorstring#a4a4aeColor of the Text Input label.
textInputLabelFontFamilystringLato-RegularFont Family of the Text Input label.
textInputLabelFontSizenumber12Font Size of the Text Input Label.
textInputLabelStyleobject{}Style of the Text Input Label.
textInputLabelVisiblebooltrueDetermines if Label is visible.
colorstring#1b1b25Color of the input text.
fontFamilystringLato-RegularFont Family of the input text.
fontSizenumber16Font Size of the input text.
borderRadiusnumber6Border Radius of the Container.

Toggles

Toggles are used to select one out of two available options or to switch between two states.

import React, { Component } from 'react'

import { Toggle } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Toggle value={true} />
    )
  }
}
import React, { Component } from 'react'

import { IconToggle } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <IconToggle defaultPosition='left' />
    )
  }
}

Available Toggle Props

PropTypeDefaultDescription
disabledboolfalseDetermines when Toggle is disabled.
onValueChangefuncFunction called after Toggle value changed.
valueboolfalseDetermines when Toggle is true/false.
onTintColorstring#2dbecdColor of the active Toggle background.
thumbTintColorstring#ffffffColor of the Toggle Grip.
tintColorstring#f8f8fcColor of the Toggle background.

Available Icon Toggle Props

PropTypeDefaultDescription
onLeftStatefuncFunction Called when Toggle moves to the left side.
onRightStatefuncFunction Called when Toggle moves to the right side.
disabledboolfalseDetermines when Toggle is disabled.
disabledThumbTintColorstring#e9e9edColor of the Disabled Toggle Grip.
disabledIconColorstring#e9e9edColor of the Disabled Icon.
tintColorstring#f8f8fcColor of the Toggle background.
thumbTintColorstring#2dbecdColor of the Toggle Grip.
iconobject{name: 'placeholder', size: 20, color: #ffffff}Icon configuration for Toggle (name from the Merck Icon library).
defaultPositionstringleftDefault Position of the Toggle left/right.

Warning labels

Warning labels display graphic elements with warnings.

import React, { Component } from 'react'

import { WarningLabel } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <WarningLabel name='explosive'
      />
    )
  }
}

Available Props

PropTypeDefaultDescription
sizenumber90Size of the warning element is equal to width and height.
namestring(isRequired)Name of the warning element - one of: compressedGas, corrosive, environmentalHazard, explosive, flammable, harmful, healthHazard, oxidizing and toxic.

Components

Accordions

Accordion displays collapsible content panels for presenting information in a limited amount of space.

import React, { Component } from 'react'

import { Accordion } from '@liquid-design/liquid-design-react-native'

const MULTIPLE_SECTIONS = [
  {
    title: 'Section Title',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam  eiusmod tempor incididunt ut labore et dolore magna aliqua.'
  },
  {
    title: 'Section Title',
    content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam  eiusmod tempor incididunt ut labore et dolore magna aliqua.'
  }
]

class Example extends Component {
  state = {
    activeSections: []
  }

  setSections(sections) {
    this.setState({ activeSections: sections })
  }

  render() {
    return (
      <Accordion
        expandMultiple
        onChange={this.setSections.bind(this)}
        activeSections={this.state.activeSections}
        sections={MULTIPLE_SECTIONS}
      />
    )
  }
}

Available Props

PropTypeDefaultDescription
expandMultipleboolfalseIf provided, will display a multiple accordions.
activeSectionsnumberstringControl which index in the sections array is currently open.
sectionsarray(isRequired)An array of sections passed to the render methods.
initiallyActiveSectionnumberIf provided, will open chosen section on start.
onChangefuncCalled everytime when one of sections is clicked.
widthnumber335Width of the accordion.
durationnumber200Duration of open/hide content animation.
onAnimationEndfunc() => {}Callback that is called when the animation is ended.
disabledboolfalseDetermines when disabled is displayed.
borderColorstring#e9e9edThe color used for the borders on top and bottom.
titleFontFamilystringLato BlackFont family of section title.
titleFontSizenumber16Font size of the section title.
titleFontWeightnumberFont weight of the section title.
titleLineHeightnumber20Line height of the section title.
inactiveTitleColorstring#1b1b25Color of the section title when section is closed.
activeTitleColorstring#2dbecdColor of the section title when section is opened.
contentFontFamilystringLato RegularFont family of section content.
contentFontSizenumber14Font size of the section content.
contentFontWeightnumberFont weight of the section content.
contentLineHeightnumber24.5Line height of the section content.
contentColorstring#1b1b25Color of the section content.
contentWidthstring100%Width of the section content.
contentHeightnumber125Height of the section content, will remove word-break effect when animating. iOS only

Badges

Badges symbolize special properties of an item or person. Badges provide a short overview about that property and its value.

import React, { Component } from 'react'

import { Badge } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Badge withIcon />
    )
  }
}

Available Props

PropTypeDefaultDescription
badgeTextstringDelivery in 3-4 daysText to display on the badge.
withIconboolfalseBoolean to show icon on the Badge.
iconPositionstringrightPosition of the icon.
disabledboolfalseStyle of disabled Badge.
simpleMaxWidthnumber152Max width of Simple type Badge.
contentBadgeWidthnumber300Width of Content type Badge.

Content Cards

import React, { Component } from 'react'

import { Badge } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <ContentCard withDetails />
    )
  }
}

Available Props

PropTypeDefaultDescription
stackedboolfalseShow a stacked Component.
imagePathstringPath to Image of Content Card.
imgWrapperSizenumber150Size of the Content Card Image.
borderRadiusnumber100Border Radius of Content Card Image.
cardTitlestringTitle NameTitle of Content Card.
labelFirststringLabel 1Text of a first label.
labelSecondstringLabel 2Text of the second label.
labelFirstValuestringValue / NumberValue of first label.
labelSecondValuestringValue / NumberValue of second label.
withDetailboolfalseShow Content Card with details.
smallDetailstringLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmodText of a Content Card Details.
headingDetailstringe.g. Amount, etc.Text of a Content Card Details Headline.
withBadgeboolfalseContent Card with a Badge.

Fly Outs

Fly outs contain a limited amount of data and have the purpose of providing brief information, short forms or tables / menus. Fly outs can be opened and closed manually by the user as well as automatically or as part of another user interaction (e.g. scrolling).

import React, { Component } from 'react'

import Flyout from '@liquid-design/liquid-design-react-native'

const options = [
  { name: 'Option 1' },
  {
    name: 'Option 2',
    options: [
      { name: 'Sub Option 1' },
      { name: 'Sub Option 2' },
      { name: 'Sub Option 3' },
      { name: 'Sub Option 4' }
    ]
  },
  { name: 'Option 3' }
]

class Example extends Component {

  render() {
    return (
      <Flyout
        options={options}
        aligned='right'
      />
    )
  }
}

Available Props

PropTypeDefaultDescription
disabledboolfalseDetermine if component is disabled.
alignedstringrightDetermined aligment of the label. One of: 'right', 'center', 'left'.
optionsarrayOptions to display on the list.
iconSizenumber24Size of the menu icon.
iconColorstring#2dbecdColor of the menu icon.
labelstringFlyout LabelLabel of the Flyout.
labelFontSizenumber16Font Size of the label.
labelColorstring#1b1b25Color of the Label.
labelFontFamilystringLato-RegularFont Family of the label.
onLabelPressfunc() => {}Function called when label pressed.
labelColorActivestring#2dbecdColor of the label when is active.
labelFontFamilyActivestringLato-BoldFont Family of the label when is active.
labelStyleobject, array{}Style of the label.
labelContainerStyleobject, array{}Style of the label container.
listWidthnumber250Width of the list. Valid only in aligned: 'right' or 'left'.
listCenteredWidthnumber150Width of the list. Valid only if aligned: 'center'.
listBackgroundColorstring#ffffffBackground Color of the list.
listStyleobject, array{}Style of the list.
headerTitlestringHeadlineHeader title.
headerStyleobject, array{}Header style.
headerFontSizenumber16Header Font Size.
headerFontFamilystringLato-BlackHeader Font Family.
headerColorstring#1b1b25Header Color.
headerContainerStyleobject, array{}Header Container Style.
headerContainerHeightnumber59Header Container Height.
onHeaderPressfunc() => {}Function Called when header is pressed.
rowStyleobject, array{}Row Style.
rowHeightnumber53Height of the list row.
rowTitleStyleobject, array{}Row title style.
rowTitleColorstring#1b1b25Row title color.
rowTitleFontSizenumber16Row title font size.
rowTtileFontFamilystringLato-RegularRow title font family.
rowBackgroundColorActivestring#f3f3f7Background Color of the row when active.
rowBackgroundColorstring#ffffffBackground Color of the row.
rowTitleColorActivestring#2dbecdColor of the row when active.
rowTitleFontFamilyActivestringLato-BlackFont Family of the row when active.
onRowPressfunc() => {}Function called when row is pressed.
arrowIconColorstring#2dbecdColor of the arrow icon.
arrowIconSizenumber24Size of the arrow icon.
subOptionTitleStyleobject, array{}Style of the suboption title.
subOptionContainerStyleobject, array{}Style of the suboption container.
onSubOptionPressfunc() => {}Function called when suboption is pressed.
subOptionContainerBackgroundColorActivestring#f3f3f7Background of the suboption container when active.
subOptionContainerBackgroundColorstring#f8f8fcBackground of the suboption container.
subOptionFontFamilystringLato-RegularFont Family of the suboption.
subOptionActiveFontFamilystringLato-BlackFont Family of the suboption when active.
subOptionActiveColorstring#2dbecdColor of the suboption when active.
subOptionColorstring#1b1b25Color of the suboption.

Modals

Modal is a static modal example (meaning its position and display have been overridden). Component can be used in Light Box.

import React, { Component } from 'react'

import Modal from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  render() {
    return (
      <Modal
        withCta
        contentText='Example text'
        buttonText='Accept'
        cancelText='Cancel'
      />
    )
  }
}

Available Props

PropTypeDefaultDescription
withGraphicboolfalseIf provided, will display a different styled component - with image.
withCtaboolfalseIf provided, will display a different styled component - with buttons.
withTextFieldboolfalseIf provided, will display a different styled component - with text field.
headerTitlestringHeader LabelTitle of the header.
headlineTextstringHeadline TextHeadline of the content.
headlineTypestringH3Type of the headline.
contentTextstringLorem ipsum dolor sit amet, consetetur sadipscing elitr(...)Text of the content.
buttonTextstringButton TextTitle of the primary button.
cancelTextstringCancel TextTitle of the secondary button.
onButtonPressfunc() => {}Function called when primary button is pressed.
onCancelPressfunc() => {}Function called when secondary button is pressed.
onBackdropPressfunc() => {}Function called when backdrop or closing icon is pressed.
placeholderstringAdd Placeholder Text hereText of the placeholder in modal with TextField.
errorMessagestringError MessageText of the error message in modal with TextField.
onErrorboolfalseDetermines when error message is displayed in modal with TextField.
onChangeTextfunc() => {}Function called when text is changes in modal with TextField.
onFocusfunc() => {}Function called when TextField is focused in modal with TextField.
onBlurfunc() => {}Function called when TextField is blurred in modal with TextField.
modalWidthnumber350Width of the modal.
imagePathnodePath of the image in modal with Graphic.
contentBgColorstring#ffffffBackground color of the modal content.
contentColorstring#1b1b25Color of the modal content text.
contentFontFamilystringLato RegularFont family of the modal content text.
contentFontWeightnumberFont weight of the modal content text.
contentFontSizenumber16Font size of the modal content text.
contentLineHeightnumber28Line height of the modal content text.
headerBgColorstring#f8f8fcBackgroud color of the modal header.
headerTitleColorstring#1b1b25Color of the modal header title.
headerFontFamilystringLato RegularFont family of the modal header title.
headerFontWeightnumberFont weight of the modal header title.
headerFontSizenumber12Font size of of the modal header title.
headerLineHeightnumber15Line height of the modal header title.
iconSizenumber20Size of the closing X icon.

Notifications

Notifications are messages that communicate information to the user. There are 4 types of notifications: simple, reminder, error and info.

import React, { Component } from 'react'

import { Notification } from '@liquid-design/liquid-design-react-native'

class Example extends Component {

  componentDidMount() {
   this.notificationRef.showNotification('error', 'Label error notification')
  }

 notificationRef = {}

  render() {
    return (
      <Notification
        ref={ref => this.notificationRef = ref}
      />
    )
  }
}

Available Props

PropTypeDefaultDescription
notificationHeightnumber40Height of the notification component.
notificationWidthnumberScreen width - 20Width of the notification component.
typestringsimpleType of the notification - one of: simple, reminder, info, error.
notificationLabelstringNotification textText of the notification label.
closingIconColorstring#ffffffColor of the closing icon.
closingIconSizenumber20Size of the closing icon.
notificationIconColorstring#ffffffColor of the notification icon (type: reminder, error).
notificationInfoIconColorstring#1b1b25Color of the notification icon (type: info).
notificationIconSizenumber20Size of the notification icon (type: reminder, error, info).
labelColorstring#ffffffColor of the notification label.
labelInfoColorstring#1b1b25Color of the notification label (type: info).
labelFontSizenumber14Font size of the notification label.
labelFontFamilystringLato BlackFont family of the notification label.
labelStyleobjectarray{}Style of the notification label.
containerStyleobjectarray{}Style of the notification component.
notificationRemoveTimeoutnumber2500Remove timeout for notification (type: simple, reminder, info).
onShowfunc() => {}Function called when notification is shown.
onDismissfunc() => {}Function called when notification is dismissed.

Bar Chart

Bar Chart is s a type of chart that presents labeled data with bars with heights or lengths proportional to the values that they represent. It is possible to place 8 bars in one single subset.

import React, { Component } from 'react'

import { BarChart } from '@liquid-design/liquid-design-react-native'

const data = [
 [
   {
     x: 2021,
     y: 150000
   },
   {
     x: 2022,
     y: 180000
   },
   {
     x: 2023,
     y: 135000
   }
 ],
 [
   {
     x: 2020,
     y: 110000
   },
   {
     x: 2021,
     y: 160000
   },
   {
     x: 2022,
     y: 180000
   },
   {
     x: 2023,
     y: 135000
   }
 ]
]

class Example extends Component {
  render() {
    return (
     <BarChart
       tickValuesX={[2020, 2021, 2022, 2023]}
       tickValuesY={[0, 60000, 100000, 140000, 180000, 220000]}
       data={data}
       xAxisTickFormat={x => `${Math.round(x)}`}
       yAxisTickFormat={y => `${Math.round(y)}`}
       xTickLabelFormat={x => `${Math.round(x)}`}
       yTickLabelFormat={y => `${Math.round(y)}`}
     />
    )
  }
}

Available Props

PropTypeDefaultDescription
dataarray(isRequired)Array of objects for Bar Chart. In single object - x, y, and descriptionLabel (text displayed inside the label) are required.
tickValuesXarray(isRequired)Values indicated on X-axis.
tickValuesYarray(isRequired)Values indicated on Y-axis.
unitstringmlUnit of the values presented.
labelsarray[]If provided, places the labels under the graph.
xAxisTickFormatfunction | Function that prettifies tickValues for X-axis.
yAxisTickFormatfunction | Function that prettifies tickValues for Y-axis.
xTickLabelFormatfunction | Function that prettifies label data value for X-axis - it is a sum of all of the bars by default.
yTickLabelFormatfunction | Function that prettifies label data value from Y-axis.
barColorsarray(string)['#2dbecd', '#eb3c96', '#ffc832', '#503291', '#a5cd50']Array with colors of the bars.
graphHeightnumber360Height of the graph.
tickDataarray(string) | Array with tick values from X-axis. yTickLabelFormat prop has precedence over tickData.

Line Graph

Line graph is s a type of chart which displays information as a series of data points connected by straight line segments. By default 2 lines will be rendered, for 1 line graph use singleChart prop and for 4 lines graph use additionalCharts prop.

import React, { Component } from 'react'

import { LineGraph } from '@liquid-design/liquid-design-react-native'

const data = {
  primaryChart: [
    { x: 1, y: 100 },
    { x: 2.5, y: 1000 },
    { x: 3.5, y: 1500 },
    { x: 4.5, y: 2000 },
    { x: 5.5, y: 2500 },
    { x: 6.5, y: 2000 },
    { x: 7.5, y: 2000 },
    { x: 8.5, y: 1900 }
  ],
  secondaryChart: [
    { x: 1, y: 1500 },
    { x: 2.5, y: 1500 },
    { x: 3.5, y: 2200 },
    { x: 4.5, y: 2700 },
    { x: 5.5, y: 3000 },
    { x: 6.5, y: 2800 },
    { x: 7.5, y: 3000 },
    { x: 8.5, y: 2600 }
  ]
}

const tickValues = [0, 2000, 4000, 6000]

class Example extends Component {
  render() {
    return (
      <LineGraph
        label1='KW 21',
        label2='KW 22',
        label3='KW 23',
        label4='KW 24',
        legendMonth='17.Oct.',
        legendYear='2017'
        tickValues={tickValues}
        primaryChart={data.primaryChart}
        secondaryChart=  {data.secondaryChart}
      />
    )
  }
}

Available Props

PropTypeDefaultDescription
primaryChartarrayArray of values for primary line chart.
primaryLineColorstring#2dbecdColor of the line for primary line chart.
primaryLineAnimDurationnumber2000Duration of animation for primary line chart.
initiallyActiveSectionnumberIf provided, will open chosen section on start.
secondaryChartarrayArray of values for secondary line chart.
secondaryLineColorstring#ffd35bColor of the line for secondary line chart.
secondaryLineAnimDurationnumber2000Duration of animation for secondary line chart.
onLoadAnimDurationnumber1000Duration of animation on load charts.
lineSizenumber3Size of the single chart line.
dotSizenumber3.5Size of the dot in chart line.
label1stringLabel of the first part of description x axis.
label2stringLabel of the second part of description x axis.
label3stringLabel of the third part of description x axis.
label4stringLabel of the fourth part of description x axis.
legendMonthstringLabel of legend (day and month).
legendYearstringLabel of legend (year).
legendColumnWidthstringWidth of the legend column.
legendMarginstring0Margin of the whole element (labels and legend).
legendWidthstring300Width of the whole element (labels and legend).
legendColorstring#1b1b25Opacity of the text in legend (labels and legend).
legendFontSizenumber12Font size of the text in legend.
tickValuearrayArray of the values for y axis.
axisOffsetnumber50Offset X of the y axis.
graphWidthnumberwidth of the screenWidth of the whole graph component.
graphWrapperPaddingnumber50Left padding of the graph component.
unitstringmlUnit of the values.
singleChartstringfalseIf true will render only primary line.
additionalChartstringfalseIf true will render 3 lines on graph (primary, secondary, additional1).
additionalChartsstringfalseIf true will render 4 lines on graph (primary, secondary, additional1, additional2).
additionalChart1arrayArray of values for first additional line chart.
additionalColor1string#000000Color of the line for first additional line chart.
additionalLineAnimDurationnumber2000Duration of animation for first additional line chart.
additionalChart2arrayArray of values for second additional line chart.
additionalColor2string#000000Color of the line for second additional line chart.
additionalLineAnimDuration2number2000Duration of animation for second additional line chart.

Paginations

Pagination is component which enables to make carousel of views with pagination.

import React, { Component } from 'react'
import { Pagination } from '@liquid-design/liquid-design-react-native'

class Example extends Component {
state = {
items: [{
  title: 'Merck Design'
},
{
  title: 'Liquid Design System'
},
{
  title: 'Product Design leaves space for the brand.'
},
{
  title: 'Product Design is unobstrusive.'
},
{
  title: 'Color sits at the heart of our brand identity.'
}]
}

renderItem = ({ item }) => (
  <View>
    <Text>{item.title}</Text>
  </View>
)

  render() {

    return (

      <Pagination
        refProp={(c) => { this.carouselRef = c }}
        carouselRef={this.carouselRef}
        data={this.state.items}
        renderItem={this.renderItem}
        onSnapToItem={index => this.setState({ activeSlide: index })}
        dotsLength={this.state.items.length}
        activeDotIndex={this.state.activeSlide}
       />
    )
  }
}

Available Props

PropTypeDefaultDescription
dataarray(isRequired)Array of carousel views.
carouselRefobject(isRequired)Control which views are in pair with pagination.
renderItemfunc(isRequired)Render paginated views.
dotsLengthnumber(isRequired)Length of the data with carousel views.
refPropfunc(isRequired)Ref of the whole component.
innerWidthnumber210Width of the space where numbers in pagination are displayed.
paginationWidthstring100%Width of the whole pagination.
paginationHeightnumber100Height of the whole pagination.
sliderHeightnumber500Height of the views which are in carousel.
iconPaddingLeftnumber10Padding left of the arrow icon.
iconPaddingRightnumber10Padding right of the arrow icon.
iconSizenumber20Size of the arrows icons.
itemWidthnumber24Width of the element in pagination (number).
itemHeightnumber24Height of the element in pagination (number).
itemPaddingLeftnumber8Padding left of the element in pagination (number).
itemPaddingRightnumber8Padding right of the element in pagination (number).
fontFamilystringLato RegularFont family of the element in pagination (number).
fontSizenumber14Font size of the element in pagination (number).
lineHeightnumber24.5Line height of the element in pagination (number).
activeFontWeightnumberFont weight of the active element in pagination (number).
activeTextColorstring#2dbecdColor of active element in pagination (number).
inactiveTextColorstring#1b1b25Color of inactive element in pagination (number).
activeBackgroundColorstring#2dbecdBackground color of active element in pagination (number).
disabledboolfalseSpecify when component is disabled.

Progress Bars

Progress bars indicate the advance of a certain interaction or process. Common use cases are page scrolling or processes like check out or registration.

Linear Progress Bar

Use linear progress bars for summarized overviews of a certain progress, as deliveries or timers.

import React, { Component } from 'react'

import ProgressBar from '@liquid-design/liquid-design-react-native'

class Example extends Component { state = { progress: 0 }

handleAdd = () => { const { progress } = this.state

const step = 5
const maxVal = 200

if (progress < maxVal) {
  this.setState({ progress: progress + step })
}

}

handleRemove = () => { const { progress } = this.state

const step = 5
const minVal = 0
if (progress > minVal) {
  this.setState({ progress: progress - step })
}

}

render() { return ( ) } }

### **Linear Progress Bar**
> Use circular progress bars for quickly advancing processes, preferrably animated, as installations or scales.
```jsx
import React, { Component } from 'react'

import ProgressBar from '@liquid-design/liquid-design-react-native'

class Example extends Component {
    state = {
      progress: 0
  }

  handleAdd = () => {
    const { progress } = this.state

    const step = 5
    const maxVal = 200

    if (progress < maxVal) {
      this.setState({ progress: progress + step })
    }
  }

  handleRemove = () => {
    const { progress } = this.state

    const step = 5
    const minVal = 0
    if (progress > minVal) {
      this.setState({ progress: progress - step })
    }
  }

  render() {
    return (
        <ProgressBar
          progress={this.state.progress}
          type='circle'
        />
      )
    }
  }

Step Progress Bar

Use the step progress bar for processes as setups, checkouts or registrations.

import React, { Component } from 'react'

import ProgressBar from '@liquid-design/liquid-design-react-native'

class Example extends Component {
    state = {
    currentStep: 0,
    labels: ['Step Label', 'Step Label', 'Step Label', 'Step Label']
  }

  handleAddStep = () => {
    const { currentStep, labels } = this.state

    const step = 1
    const maxVal = labels.length
    if (currentStep < maxVal) {
      this.setState({ currentStep: currentStep + step })
    }
  }

  handleRemoveStep = () => {
    const { currentStep } = this.state

    const step = 1
    const minVal = 0
    if (currentStep > minVal) {
      this.setState({ currentStep: currentStep - step })
    }
  }

  render() {
    const { labels } = this.state
    return (
       <ProgressBar
          currentPosition={currentStep}
          type='step'
          labels={labels}
      />
      )
    }
  }

Available Props

PropTypeDefaultDescription
inactiveboolfalseDisables Progress Bar.
typestringcircleType of Progress Bar to render.
progressnumberValue of Progress in Circle and Linear Progress Bar (see example).
linearProgressBarWidthnumber300Width of a Linear Progress Bar.
circleSizenumber140Size of a Circle.
circleLabelstringLabelLabel inside a Circle.
currentPositionnumber Prop for manipulating current position of the Step Progress Bar (see example).
stepCount4Number of steps in Step Progress Bar.
labelsarrayLabels for Step Indicators of Step Progress Bar.