Container¶
Container
type creates a Container element in the sidebar content. It is a special element that has its own content area with custom styles and It can have children components.
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import INKAPI from './inkapi.js'
INKAPI.ready(async () => {
const UI = INKAPI.ui;
const sidebarObj = await UI.create({
type: "Sidebar",
sidebarTitle: "Personal Sidebar",
icon: "./sample.svg",
children: [
{
type: "Container",
id: "myContainer",
styles: {
"border-radius": "5px",
}
layout: [3, 3], // two columns and two rows
},
],
});
console.log(sidebarObj);
});
|
Options¶
Name |
Type |
Description |
---|---|---|
id? |
|
You can assign a unique id to the component. It will be helpful for listening to events and removing component in future. If |
type |
|
This field should be passed |
layout? |
|
This will create grid like structure for your container content. you can specify number of columns and rows for the layout. Each children can position themselves using styles field. |
hidden? |
|
If set to |
emptyStateData? |
|
String data to be displayed as an empty state. |
styles? |
|
Custom styles for the element. |
Shadow Methods¶
Methods |
Arguments |
Description |
---|---|---|
show |
|
This will unhide the container. |
hide |
|
This will hide the container. |
setStyles |
|
This function can be used to apply styles to the component. |
hideEmptyState |
|
This will hide the empty state. |
showEmptyState |
data?: |
This will unhide the empty state. Optional parameter can be used to assign data to the empty state. |
Note
To learn more about shadow methods and shadow objects, please refer here.