Py.Cafe

huong-li-nguyen/

vizro-flex-text-renderer-0

Enhanced Flex-based Text Renderer

DocsPricing
  • assets/
  • app.py
  • requirements.txt
app.py
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
26
27
28
29
30
31
32
33
34
35
from vizro import Vizro
import vizro.models as vm


def container(title, texts):
    return vm.Container(
        layout=vm.Flex(direction="row"),
        title=title,
        components=
    [
        vm.Card(text=text)
        for text in texts
    ])

def components():
    return [container("Long and short text",
    ["long text " * 100] + ["short text"] * 4),
    container("Short and short text", ["short text"] * 5)]

page = vm.Page(
    title="Current rendering",
    layout=vm.Flex(direction="column"),
    components=components()
)

page2 = vm.Page(
    id="new_rendering",
    title="What they want?",
    layout=vm.Flex(direction="column"),
    components=components(),
)

dashboard = vm.Dashboard(pages=[page, page2])
Vizro().build(dashboard).run()