Skip to content

Commit

Permalink
chore: update docs #1887
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-mihok committed Mar 27, 2023
1 parent 73b6035 commit a9467d7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions py/examples/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ async def serve(q: Q):
ui.button(name='button_with_icon', label='Button with an icon', icon='Search'),
ui.button(name='icon_button', icon='Heart', caption='Tooltip text'),
ui.button(name='external_path_button', label='External', path='https://h2o.ai/'),
ui.button(name='choice_button', label='Button with choices', primary=True, icon='Like', choices=[
ui.button_choice(name='first_choice', label='First choice', icon='Heart'),
ui.button_choice(name='second_choice', label='Second choice', icon='Dislike'),
ui.button(name='choice_button', label='Button with choices', primary=True, choices=[
ui.button_choice(name='first_choice', label='First choice'),
ui.button_choice(name='second_choice', label='Second choice'),
]
),
])
Expand Down
15 changes: 15 additions & 0 deletions website/widgets/form/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,18 @@ q.page['form'] = ui.form_card(box='1 1 1 2', items=[
])
])
```

In addition, each choice supports `caption`, `icon`, `value`, `disabled` and `path` attributes which work exactly like with the button.

```py
q.page['form'] = ui.form_card(box='1 1 1 2', items=[
ui.button(
name='like',
value='reaction_like',
icon='Like',
choices=[
ui.button_choice(name='love', icon='Heart', value='reaction_love'),
ui.button_choice(name='dislike', icon='Dislike', value='reaction_dislike', disabled=True)
])
])
```

0 comments on commit a9467d7

Please sign in to comment.