How to use the idom.html function in idom

To help you get started, we’ve selected a few idom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rmorshea / idom / tests / test_core / test_render.py View on Github external
async def Clickable(self, count=0):
        @idom.event(target_id="an-event")
        async def an_event():
            self.update(count=count + 1)

        return idom.html.div({"anEvent": an_event, "count": count})
github rmorshea / idom / tests / test_core / test_render.py View on Github external
async def AnyElement(self):
        return idom.html.div()
github rmorshea / idom / tests / test_widgets / test_html.py View on Github external
async def InputWrapper():
        return idom.html.div(
            idom.widgets.Input(
                inp_ingore_var.set,
                "number",
                inp_ingore_var.value,
                {"id": "inp-ignore"},
                ignore_empty=True,
            ),
            idom.widgets.Input(
                inp_not_ignore_var.set,
                "number",
                inp_not_ignore_var.value,
                {"id": "inp-not-ignore"},
                ignore_empty=False,
            ),
github rmorshea / idom / tests / test_server / test_sanic / test_shared_state_client.py View on Github external
async def IncrCounter(self, count=0):
        @idom.event
        async def incr_on_click(event):
            self.update(count + 1)

        button = idom.html.button(
            {"onClick": incr_on_click, "id": "incr-button"}, "click to increment"
        )

        return idom.html.div(button, Counter(count))
github rmorshea / idom / tests / test_core / test_hooks.py View on Github external
async def simple_stateful_element():
        index, set_index = idom.hooks.use_state(0)
        set_index(index + 1)
        return idom.html.div(index)
github rmorshea / idom / docs / source / widgets / todo.py View on Github external
tasks = []

    for index, text in enumerate(items):

        async def remove_task(event, index=index):
            set_items(items[:index] + items[index + 1 :])

        task_text = idom.html.td(idom.html.p(text))
        delete_button = idom.html.td({"onClick": remove_task}, idom.html.button(["x"]))
        tasks.append(idom.html.tr(task_text, delete_button))

    task_input = idom.html.input({"onKeyDown": add_new_task})
    task_table = idom.html.table(tasks)

    return idom.html.div(task_input, task_table)
github rmorshea / idom / docs / source / widgets / custom_chart.py View on Github external
async def ShowChartClicks(self):

    log = EventLog({})

    async def log_event(event):
        log.update(event)

    return idom.html.div(
        ClickableChart(
            {
                "data": data,
                "onClick": log_event,
                "style": {"parent": {"width": "500px"}},
            },
        ),
        log,
    )