2.0.1 • Published 6 years ago

@moduware/morph-tabbar v2.0.1

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
6 years ago

morph-tabbar

License Published on webcomponents.org

A fast and lightweight custom web component tab bar that automatically detects device and looks native IOS or native Android, depending on current mobile OS. It uses LitElement base class.

Morph Components are now being updated to use lit-element as base class from polymer base class.

morph-tabbar is the containing parent element for the morph-tabbar-item. These components changes its appearance automatically based on whether the platform or device is IOS or Android.

Getting Started

For the information about how to clone the desired repository, running the local server and testing, please refer to Polymorph elements getting started docs at the end of this repository.

Demo

<h3>Andriod tabbar</h3>
<p>Click the items to see it in action</p>

<morph-tabbar platform="android" selected="play" label> 
  <morph-tabbar-item platform="android" name="play" not-selected-image="img/play_android.svg" selected-image="img/play_android_selected.svg" has-label>play</morph-tabbar-item>
  <morph-tabbar-item platform="android" name="favorite" not-selected-image="img/favorite_android.svg" selected-image="img/favorite_android_selected.svg" has-label>favorite</morph-tabbar-item>
  <morph-tabbar-item platform="android" name="mic" not-selected-image="img/mic_android.svg" selected-image="img/mic_android_selected.svg" has-label>mic</morph-tabbar-item>
</morph-tabbar>

<h3>IOS tabbar</h3>
<p>Click the items to see it in action</p>

<morph-tabbar platform="ios" selected="play" label>
  <morph-tabbar-item platform="ios" name="play" not-selected-image="img/play_ios.svg" selected-image="img/play_ios_selected.svg" has-label>play</morph-tabbar-item>
  <morph-tabbar-item platform="ios" name="favorite" not-selected-image="img/favorite_ios.svg" selected-image="img/favorite_ios_selected.svg" has-label>favorite</morph-tabbar-item>
  <morph-tabbar-item platform="ios" name="mic" not-selected-image="img/mic_ios.svg" selected-image="img/mic_ios_selected.svg" has-label>mic</morph-tabbar-item>
</morph-tabbar>
  • Here is a quick demo of the morph-tabbar element.
  <template>
    <h3>IOS morph-tabbar demo</h3>
    <morph-tabbar platform="ios" selected="play">
      <morph-tabbar-item platform="ios" name="play" not-selected-image="../img/play_ios.svg" selected-image="../img/play_ios_selected.svg"></morph-tabbar-item>
      <morph-tabbar-item platform="ios" name="favorite" not-selected-image="../img/favorite_ios.svg" selected-image="../img/favorite_ios_selected.svg"></morph-tabbar-item>
      <morph-tabbar-item platform="ios" name="mic" not-selected-image="../img/mic_ios.svg" selected-image="../img/mic_ios_selected.svg"></morph-tabbar-item>
    </morph-tabbar>
  </template>
<template>
  <h3>Android morph-tabbar with label demo</h3>
  <morph-tabbar platform="android" selected="play" label>
    <morph-tabbar-item platform="android" name="play" not-selected-image="../img/play_android.svg" selected-image="../img/play_android_selected.svg" label></morph-tabbar-item>
    <morph-tabbar-item platform="android" name="favorite" not-selected-image="../img/favorite_android.svg" selected-image="../img/favorite_android_selected.svg" label></morph-tabbar-item>
    <morph-tabbar-item platform="android" name="mic" not-selected-image="../img/mic_android.svg" selected-image="../img/mic_android_selected.svg" label></morph-tabbar-item>
  </morph-tabbar>
</template>

Attributes

Custom AttributeTypeDescriptionDefault
selectedStringTakes the value of name attribute of the selected tabbar item. In order to have default selected item, assign it's name.null
labelBooleanTo have a tabbar with label assign truefalse

Styling

-For Android platform;

Custom propertyDescriptionDefault
--android-background-colorBackground color of the tabbar#0076FF
--android-heightHeight of the tabbar48px
--android-labeled-heightHeight of the tabbar with label72px
--android-bar-colorColor of the highlight bar under tabbarrgba(255,255,255,.7)

-For IOS platform;

Custom propertyDescriptionDefault
--ios-background-colorBackground color of the tabbar#f7f7f8
--ios-heightHeight of the tabbar44px
--ios-labeled-heightHeight of the tabbar with label50px
--ios-bar-colorColor of the highlight bar above tabbar#c4c4c4

NOTE: For tabbar to take on the parent background color, you can assign --android-background-color: transparent or --ios-background-color: transparent

Further help

For more information on how to install and run test please go here - Polymorph elements getting started