Icon widget
The Icon Widget enables easy integration of icons from popular libraries like FontAwesome, allowing for seamless customization and visually appealing designs within your application.
Test in Kitchen Sink (opens in a new tab)
Properties
Property | Type | Description |
---|---|---|
icon | string | Icon name from Material Icons or Font Awesome |
library | string | Which icon library to use, if there is no value for library then its considered to be default. fontAwesome remix ( for now only few remix icons are supported but we will support most them soon) You can check list of supported icons here |
onTap | action | Call Ensemble's built-in functions or execute code |
onTapHaptic | enum | The type of haptic to perform when icon is pressed. It should be one of heavyImpact, mediumImpact, lightImpact, selectionClick, and vibrate |
styles | object | See properties |
styles
Property | Type | Description |
---|---|---|
expanded | boolean | If the parent is a Row or Column, this flag will stretch this widget in the appropriate direction. (e.g stretch horizontally for parent of type Row) |
color | integer or string | The color of the icon, which can be represented in different formats. It can be specified as a number, a predefined color name, or a hexadecimal value starting with '0x'. transparent black blue white red grey teal amber pink purple yellow green brown cyan indigo lime orange |
splashColor | integer or string | If onTap is defined, this color will show up as a splash effect upon tapping the icon. Note that the effect only happens if backgroundColor is not set. which can be represented in different formats. It can be specified as a number, a predefined color name, or a hexadecimal value starting with '0x'. transparent black blue white red grey teal amber pink purple yellow green brown cyan indigo lime orange |
visible | boolean | Toggle a widget visibility on/off. Note that an invisible widget will not occupy UI space, unless the visibilityTransitionDuration is specified. |
elevation | integer | The z-coordinate at which to place this material relative to its parent. A non-zero value will show a shadow, with its size relative to the elevation value. Minimum value: 0, Maximum value: 24 |
elevationShadowColor | integer or string | The shadow color for the elevation, which can be represented in different formats. It can be specified as a number, a predefined color name, or a hexadecimal value starting with '0x'. transparent black blue white red grey teal amber pink purple yellow green brown cyan indigo lime orange |
elevationBorderRadius | string or integer | The border radius of the widget.This can be specified using CSS-like notation with 1 to 4 integers. Minimum value: 0. |
alignment | string | The alignment of the widget relative to its parent topLeft , topCenter , topRight , centerLeft , center , centerRight , bottomLeft , bottomCenter , bottomRight . |
borderRadius | string or integer | The border radius of the widget.This can be specified using CSS-like notation with 1 to 4 integers. Minimum value: 0. |
borderColor | integer or string | Sets the border color, starting with '0xFF' for full opacity. transparent black blue white red grey teal amber pink purple yellow green brown cyan indigo lime orange |
borderWidth | integer or string | Thickness of the border. Minimum value should be 0. |
shadowColor | integer or string | Sets the box shadow color starting with '0xFF' for full opacity. transparent black blue white red grey teal amber pink purple yellow green brown cyan indigo lime orange |
shadowOffset | array | The values in array define the horizontal and vertical offset of the shadow. Example: if the shadowOffset is set to [2, 4], the shadow will be offset by 2 pixels horizontally and 4 pixels vertically from its original position. |
shadowRadius | string or integer | The border radius of the widget.This can be specified using CSS-like notation with 1 to 4 integers. Minimum value: 0. |
shadowStyle | string | The blur style to apply on the shadow normal , solid , outer , inner |
stackPositionTop | integer | The distance of the child's top edge from the top of the stack. This is applicable only for Stack's children. |
stackPositionBottom | integer | The distance that the child's bottom edge from the bottom of the stack. This is applicable only for Stack's children. |
stackPositionLeft | integer | The distance that the child's left edge from the left of the stack. This is applicable only for Stack's children. |
stackPositionRight | integer | The distance that the child's right edge from the right of the stack. This is applicable only for Stack's children. |
captureWebPointer | boolean | Applicable for Web only. When overlaying widgets on top of certain HTML container (e.g. Maps), the mouse click is captured by the HTML container, causing issue interacting with the widget. Use this to capture and maintain the mouse pointer on your widget. |
margin | string or integer | Margin with CSS-style notation |
padding | string or integer | Padding with CSS-style value |
size | integer | Defines the dimensions or magnitude of an element, allowing control over its overall size within the layout. |
visibilityTransitionDuration | integer | Specify the duration in seconds when a widget animates between visible and not visible state. Note that setting this value will cause the widget to still occupy the UI space even when it is not visible. |
visible | boolean | Toggle a widget visibility on/off. Note that an invisible widget will not occupy UI space, unless the visibilityTransitionDuration is specified. |
backgroundImage | object | Background image of the box. see properties |
backgroundGradient | object | Background gradient of the box see properties |
backgroundColor | integer or string | Background color of the box. which can be represented in different formats. It can be specified as a number, a predefined color name, or a hexadecimal value starting with '0x'. transparent black blue white red grey teal amber pink purple yellow green brown cyan indigo lime orange |
styles.backgroundGradient
Property | Type | Description |
---|---|---|
colors | array | The list of colors used for the gradient. Colors can be represented in different formats. It can be specified as a number, a predefined color name, or a hexadecimal value starting with '0x'. |
start | string | The starting position of the gradient |
end | string | The ending position of the gradient |
styles.backgroundImage
Property | Type | Description |
---|---|---|
source | string | The Image URL to fill the background |
fit | string | How to fit the image within our width/height or our parent (if dimension is not specified) . see options |
alignment | string | Alignment of the background image |
Fit options for styles.backgroundImage
Option | Description |
---|---|
fill | Stretch our image to fill the dimension, and distorting the aspect ratio if needed |
contain | Scale the image such that the entire image is contained within our dimension |
cover | Scale the image to fill our dimension, clipping the image as needed |
fitWidth | Scale the image to fit the width, and clipping the height if needed |
fitHeight | Scale the image to fit the height, and clipping the width if needed |
none | Center-Align the original image size, clipping the content if needed |
scaleDown | Center-Align the image and only scale down to fit. Image will not be scaled up to bigger dimension. |