Menu
Definition
OR
Example
Attributes
Attribute | Value | Description |
---|---|---|
id | string type | Identifier for component. |
value | array type | Selected item(s) from the list |
required | boolean type | Specifies if field must be filled. |
disabled | boolean type | Specifies if component should be disabled.(aurelia ext attribute) |
autofocus | boolean type | Specifies if component should be focused when loaded. |
multiple | boolean type | Specifies that multiple options can be selected at once. |
class | cst-mat-filled (default if material design) cst-mat-outlined cst-mat-shaped-filled cst-mat-shaped-outlined | Specifies class to be applied(Multiple classes can be given with space). |
object type | Specifies theme to be used for component. | |
object type | Specifies fonts to be used for component. | |
object type | Specifies style to be applied to component. | |
object type | Specifies label to be displayed. | |
array type | Specifies icons to be displayed. | |
object type | Specifies the options of the component. | |
object type | Specifies help icon to be displayed. | |
object | Specifies what features to enable/disable. | |
other | any type | Any other info. |
schema | object type | Specifies JSON schema. |
schema-prop | string type | Specifies property to be used to pick schema. |
Sub element attributes
sub-theme
Property | Value | Description |
---|---|---|
name | primary(default)/secondary/custom | Name of the theme. |
clr-label | string type | If custom then specific/ named color variables |
sub-font
Property | Value | Description |
---|---|---|
name | roboto (default)/custom | Name of the font |
font-text | string type | If custom then specific/ named font variables. |
font-label | string type | |
font-error | string type |
sub-style
Property | Value | Description |
---|---|---|
name | material/skeuomorphic/material-open/skeuomorphic-open | Name of design to be used. |
width | percentage/pixels/string(x-small,small,medium,large,x-large) | Gives width/any other prop value |
sub-label
Property | Value | Description |
---|---|---|
text | string type | Label text. |
position | left/top/center(default) | Position of the label. |
sub-lr-icons
(a.k.a left right icons)
Property | Value | Description |
---|---|---|
name | string type | Icon name. |
position | left/right | Position of the icon. |
title | string type | Icon tooltip |
link | string type | Link to be opened on click of icon. |
sub-options
Property | Value | Description |
---|---|---|
items-prop | string type | Property of item array |
item-text-prop | string type | Property of item's text, display in list. |
item-sub-text-prop | string type | Property of item's small text, display in list. |
item-value-prop | string type | Property of item's value |
checkbox-position | string type(left/right) | Position of checkbox in item if feature-flag is allow-selection or multiple is true |
sub-help-icon
Property | Value | Description |
---|---|---|
name | string type | Icon name. |
position | left/right | Position of the icon. |
title | string type | Icon tooltip |
link | string type | Link to be opened on click. |
sub-feature-flag
Property | Value | Description |
---|---|---|
allow-selection | boolean type | Specifies to select item. Display checkbox in front of item |
allow-search | boolean type | Specifies to search items. Display search textbox at top |
disable-ripple | boolean type | Disables ripple effec when given true. |
Schema Examples
Full schema
Fetch appropriate based on schemaProp
Exact schema
Nested object
Nested object schemaProp
Material Measurement Guidelines
Minimum and maximum
- min-width = 112px
- max-width = 280px
- space from top = 8px
- space from bottom = 8px
- space from left = 16px
- space from right = 16px
- item's min-height = 48px
Minimum
Maximum
Mobile
- Top section
- height = 32px
- width = 128px
- right side arrow icon width = 40px
- right side arrow icon height = 24px
- space from top = 8px
- space from bottom = 4px
- space from left = 16px
- space from right = 8px
- border = 1px
- Selection section
- height = 144px
- space from top = 8px
- space from bottom = 8px
- space from left = 16px
- space from right = 8px
- item's height = 32px
With Icon
Normal
- min-width = as per content
- space from top = 8px
- space from bottom = 8px
- space from left = 24px
- space from right = 24px
- item height = 48px
- icon height = 24px
- icon width = 24px
- space b/w left icon and item = 20px
- border = 1px
Dense
- max-width = 320px
- space from top = 8px
- space from bottom = 8px
- space from left = 16px
- space from right = 15px
- item height = 32px
- icon height = 24px
- icon width = 24px
- space b/w left icon and item = 20px
- border = 1px
Events
Attribute | Description |
---|---|
onchange | Fires when the element's value changes(for dropdown). |
onclick | Fires when the item clicked(for menu item click). |
oninvalid | Script to be run when an element is invalid. |
onreset | Fires when reset button is clicked. |
onvalidate | Custom validate hook, must return error message else considered valid; will be called onchange. |
Event Method signature
method(parentRefObj, evtObj, elm, others)
Parameters description
Parameter | Value | Description |
---|---|---|
parentRefObj | parentRefObj = { parentContext, loopParentContext, doubleLoopParentContext } | Parent Context references |
evtObj | object | Event object |
elm | object | Element value |
others | any | Other value |
Features
Display menu of items/ nested items/ group items
Nested items have expand icon at right corner, on click of which displays sub menu item.
Each item can have prefix/ suffix icon
Each item/ nested item have checkbox selection (nested item partial selection is denoted by checkbox indeterminate state)
Item Selection
- Single selection
- Multi selection
- going with style: fixed width (eg: selected value is "Monday (+1 other)")
- alternative style: chips (add image)
- View selected/ all/ search (tab view at top) //so top level not editable
- Use checkbox indeterminate state for nested item partial selection
Menu with group headers / dividers between group
Scrollable menu
auto complete dropdown (search & select)
- static data(All, selected & search option)
- API data (selected & search option)
For large data, search all or with in a group
For large data, async nested items load
Same component for dropdown, menu, nested menu
Every items must have id prop (add in check list)