Table extras
Table cells can be declared via JSON using verbose syntax. But we can use a different JSON syntax to declare cells with special content. The Table will generate components based on the value of the item
property and this can be one of the following.
Icon
This function returns the JSON to generate an icon.
The type
configures the icon classname and the optional color
property can be one of black
, medium
, red
, green
, blue
and purple
.
Here are the configurable properties of the IconModel
.
This interface may change as we upgrade to SVG icons.
Image
This function returns the JSON to generate an Image.
Note that the width
and height
properties are mandatory for us to fix the dimensions of the image even before it is loaded. This will prevent the page from jumping around.
We can also declare a boolean property background
in the JSON. If set to true
, the image will be rendered as a background-image
to unlock further processing via CSS (for example via the background-size property). Here are the configurable properties.
Switch
This function returns the JSON to generate a Switch.
The Switch is the checkbox that looks like some kind of switch.
TODO: We could need a layout feature to fix the width of the switch column.
Here are the configurable properties of the SwitchModel
.
UserImage
This function returns the JSON to generate a UserImage.
If you like, you can also specify a size
to adjust the width and height of the image.
Here are the properties of the UserImage.