Button

Definition

<cst-button>
<sub-theme/>
<sub-font/>
<sub-style/>
<sub-access/>
<sub-lr-icon/>
<sub-lr-icon/>
<sub-help-icon/>
<sub-feature-flag/>
</cst-button>

Example

<cst-button id="" value="">
<sub-theme name="" clr-var1="" clr-var2=""/>
<sub-font name="" font-var1="" font-var2=""/>
<sub-style name="" width="" height=""/>
<sub-access can-view="" can-modify=""/>
<sub-lr-icon name="mobile" position="left"/>
<sub-help-icon name="help" position="right" title="" link="">/>
<sub-feature-flag disable-ripple="" disable-uppercase=""/>
</cst-button>

OR

<cst-element name="button" schema="" schema-prop="" value=""/>

Attributes

Specifies class to be applied(Multiple classes can be given with space).
AttributeValueDescription
idstring typeIdentifier for component
valuestring typeLabel to be shown on button.
titlestring typeButton Tooltip
disabledboolean typeSpecifies if button has to be disabled.(aurelia ext attribute)
autofocusboolean typeSpecifies if component should be focused when loaded.
hrefstring typeUrl to redirect on button click.
classcst-mat-text
cst-mat-outlined
cst-mat-raised (default if material design)
cst-mat-unelevated
cst-mat-shaped

sub-theme

object typeSpecifies theme to be used for component.

sub-font

object type Specifies fonts to be used for component.

sub-style

object typeSpecifies style to be applied to component.

sub-lr-icons

array typeSpecifies icons to be displayed.

sub-help-icon

object typeSpecifies help icon to be displayed.

sub-feature-flag

object typeSpecifies features to enable/disable.
othersobject typeAny other info.
schemaobject type Specifies JSON schema.
schema-propstring type Specifies property to be used to pick schema.

Sub element attributes

sub-theme

PropertyValueDescription
nameprimary(default)/secondary/customName of the theme.
clr-labelstring typeIf custom then specific/ named color variables

sub-font

PropertyValueDescription
nameroboto (default)/customName of the font
font-textstring typeIf custom then specific/ named font variables.
font-labelstring type
font-errorstring type

sub-style

PropertyValueDescription
namematerial/skeuomorphic(standard/outlined/text)Name of design to be used.
widthpercentage/pixels/string(x-small,small,medium,large,x-large)Gives width/any other prop value

sub-lr-icons

(a.k.a left right icons)

PropertyValueDescription
namestring typeIcon name.
positionleft/rightPosition of the icon.
titlestring typeIcon tooltip

sub-help-icon

PropertyValueDescription
namestring typeIcon name.
positionleft/rightPosition of the icon.
titlestring typeIcon tooltip
linkstring typeLink to be opened on click.

sub-feature-flag

PropertyValueDescription
disable-rippleboolean typeDisables ripple effec when given true.
disable-uppercaseboolean typeDisables Upper case when showing button label.
is-icon-buttonboolean typeWhether the button is icon button.
is-round-buttonboolean typeWhether the button is round.

Schema Examples

Example1

let schema = {
type: "object",
properties: {
btnSaveCustomer: {
type: "string",
title:"Click to Save",//= tooltip
cstAttr: {
elementName: 'button',
raw:{ //loop & add to element
disabled : true,
autofocus : false,
class:'',
href:''
},
others:{
}
subTheme:{
name:'',
clrLabel:''
},
subFont:{
name:'',
fontText:'',
fontLabel:'',
fontError:''
},
subStyle: {
name:'',
width:'', //percentage/pixels,string
height:'',
fontSize:''
},
subLrIcons:[{
name:'',
position:'',
title: ''
}],
subHelpIcon: {
name: '',
position: '',
title:'',
link:''
},
subFeatureFlag: {
disableRipple: true,
disableUppercase: true,
isIconButton: false,
isRoundButton: false
}
}
}
}
}
let schemaProp = 'btnSaveCustomer';
let value = 'Save'
let finalSchema = schemaProp ? schema.properties[schemaProp] : schema;

Common Note:

Material Measurements Guidelines

Contained Button

  • min-width = 64px
  • height = 36px
  • padding left and right = 16px

Spec

Contained Button with icon

  • min-width = 64px
  • height = 36px
  • padding left = 12px
  • padding right = 16px
  • icon dimensions = 18X18
  • icon margin right = 8px

Spec

Outlined Button

  • min-width = 64px
  • height = 36px
  • padding left and right = 16px
  • border = 1px

Spec

Text Button

  • min-width = 64px
  • height = 36px
  • padding left and right = 8px

Spec

Events

AttributeDescription
onClickTriggered when button is clicked.

Event Method signature

method(parentRefObj, evtObj, elm, others)

Parameters description

ParameterValueDescription
parentRefObj
parentRefObj = {
parentContext,
loopParentContext,
doubleLoopParentContext
}
Parent Context references
evtObjobjectEvent object
elmobjectElement value
othersanyOther value

Over-ridable Classes

  • cst-ovr-button-elm
  • cst-ovr-button
  • cst-ovr-button-label
  • cst-ovr-button-left-icon
  • cst-ovr-button-right-icon
  • cst-ovr-button-hover
  • cst-ovr-button-disabled
  • cst-ovr-button-pressed

Unit test Screenshots

Responsiveness Test Screenshots

Design Images

Demo link

Points

  • Show state indication (disabled/ hover/ pressed)
  • Help icon
  • fonts (Roboto Condensed - ALL CAPS BOLD - 14)
  • event callback consistency
  • if large helper text wrap (mobile/ web)
  • Should we add toggle button/icon feature in same component or they will be 2 different components?
  • ignore uppercase property?
  • accessibility in mind
  • over-rideable classes for button, hover, pressed
  • adds material design measurements
  • unit test screen shots
  • ui + responsive test screen shots
  • component demo link
  • bring designer's images in docs
  • For toggling button create different component, and show/hide two different buttons in that component.