|
| 1 | +from dazzler.system import Page, transforms as t |
| 2 | +from dazzler.components import html |
| 3 | + |
| 4 | + |
| 5 | +page = Page( |
| 6 | + __name__, |
| 7 | + html.Div([ |
| 8 | + html.H1('Dazzler html components'), |
| 9 | + html.Main([ |
| 10 | + html.Section([ |
| 11 | + html.H3('Inputs'), |
| 12 | + html.Div('clicker', identity='clicker', handle_clicks=True), |
| 13 | + html.Select([ |
| 14 | + html.Option('opt 1', value=1), |
| 15 | + html.Option('opt 2', value=2), |
| 16 | + html.Option('opt 3', value=3) |
| 17 | + ], handle_focus=True, identity='focus-select'), |
| 18 | + html.Div( |
| 19 | + 'Hoverable', |
| 20 | + identity='hoverable', |
| 21 | + handle_hover=True, |
| 22 | + style={'padding': 12, 'background': '#dcdcdc'} |
| 23 | + ), |
| 24 | + ]), |
| 25 | + html.Section([ |
| 26 | + html.H3('Outputs'), |
| 27 | + html.Div(identity='clicker-output'), |
| 28 | + html.Div(identity='clicker-event-output'), |
| 29 | + html.Div(identity='hover-output'), |
| 30 | + html.Div(identity='focus-output'), |
| 31 | + ]), |
| 32 | + ]), |
| 33 | + ]), |
| 34 | + packages=['dazzler_html'] |
| 35 | +) |
| 36 | + |
| 37 | +page.tie('clicks@clicker', 'children@clicker-output') |
| 38 | +page.tie('click_event@clicker', 'children@clicker-event-output').transform( |
| 39 | + t.ToJson() |
| 40 | +) |
| 41 | +page.tie('is_focused@focus-select', 'children@focus-output').transform( |
| 42 | + t.Format('Focused: ${value}') |
| 43 | +) |
| 44 | +page.tie('is_hovered@hoverable', 'children@hover-output').transform( |
| 45 | + t.Format('Hovered: ${value}') |
| 46 | +) |
0 commit comments