Shimoku docs
Search…
⌃K

Raw HTML

An HTML component is used for inserting images, messages, links and texts on the page, to help document business processes or applications.

The method to use

The method is shimoku.plt.html()
It must contain the following input variables:
html: str
menu_path: str
order: int
And accepts the following input variables as optional:
title: Optional[str]
rows_size: Optional[int]
cols_size: Optional[int]
padding: Optional[List[int]]

Examples

1. Default configuration

html = (
"<p style='background-color: #daf4f0';>"
"Comparing the results of predictions that happened in previous "
"periods vs reality, so that you can measure the accuracy of our predictor."
"</p>"
)
shimoku.plt.html(
html=html,
menu_path='test/html-1',
order=0, rows_size=2, cols_size=12,
)
The result is:

2. Title for HTML, changing data, size and padding

html = (
"<p style='background-color: #daf4f0';>"
"The goal of this logistics plan is to meet customer "
"requirements in a timely, cost-effective manner."
"</p>"
)
shimoku.plt.html(
html=html,
menu_path='test/html-2',
order=0, rows_size=2, cols_size=8,
padding='0,0,0,2',
)
The result is:
Note the space before the component using padding='0,0,0,2', and size with cols_size=8.

3. Adding graphic HTML component

Warning: We do not recommend to abuse on this technique since it can remarkably reduce the performance of your Data App, if possible use Shimoku components.
This component is done using:
html = '''<div class="styles_grid_item_padding__MzexJ" style="grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); grid-area: span 1 / span 2 / span 2 / span 3; gap: 32px 16px;">
<div class="css-upombs" data-testid="GRID_ITEM-92c7bf38-abb2-473e-8e10-7a446a93d9a5" style="grid-area: 1 / 1 / span 2 / span 2; min-height: 352px; max-height: 352px;">
<div type="HTML" data-testid="REPORT-HTML-92c7bf38-abb2-473e-8e10-7a446a93d9a5" class="css-cgjako">
<div class="ReportWrapper_container_report__cT7bu">
<div class="styles_container__html__pgebp">
<div class="">
<style>.rectangle{height:300px; width:166px; background-color:#13bfa8; border-radius:0px 100px 0px 100px;}</style>
<div class="rectangle">
<h1 style="color:#fff; padding:10%;">This is a title</h1>
</div>
</div>
</div>
</div>
</div>
</div>
</div>'''
shimoku.plt.html(
html=html,
menu_path='test/html-3',
order=0,
)
The result is:
The code for background color is #13bfa8.

HTML components

Step by step

In addition to the presented HTML components, we have special HTML components in Shimoku's Front-End Components Catalog ready to use.
To use this Catalog you must first install it.
In your Python +3.6 install it using:
pip install shimoku-components-catalog
or either:
pip install --upgrade shimoku-components-catalog
Prepare a python file to use the components, with this:
from os import getenv
import shimoku_api_python as shimoku
from shimoku_components_catalog.html_components import (
create_h1_title, button_click_to_new_tab, beautiful_indicator,
box_with_button, panel,
)
# Environment variables (credentials):
api_key: str = getenv('API_TOKEN')
universe_id: str = getenv('UNIVERSE_ID')
business_id: str = getenv('BUSINESS_ID')
environment: str = getenv('ENVIRONMENT')
shimoku = shimoku.Client(
config={'access_token': api_key},
universe_id=universe_id,
environment=environment,
)
shimoku.plt.set_business(business_id=business_id)
These components are used to show messages, embed a link in a button with text, or embed a link in a text, with style.

The method to use

The method is the same: shimoku.plt.html(), andits usage depends on the component chosen. Each component call its own function as argument of the shimoku.plt.html() method.
There are five components ready to use described in the following pages.
It is possible to group HTML elements, components and many charts on a page, like this:
It is possible to use any number of rows.
Changing menu_path The menu_path can be modified.
It is possible to use any number of rows.