-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fc622b
commit 75f56e6
Showing
4 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Disclosure | ||
|
||
A collapsible section of content with a heading that toggles the visibility of a panel. | ||
|
||
## Example | ||
|
||
```python | ||
from deephaven import ui | ||
|
||
my_disclosure_basic = ui.disclosure(title="Heading", panel="Content") | ||
``` | ||
|
||
## Events | ||
|
||
Disclosure accepts an `on_expanded_change` prop which triggers when it is expanded or collapsed. | ||
|
||
```python | ||
from deephaven import ui | ||
|
||
|
||
@ui.component | ||
def ui_toggle_disclosure(): | ||
is_expanded, set_is_expanded = ui.use_state(False) | ||
|
||
return ui.flex( | ||
ui.disclosure( | ||
title="Heading", | ||
panel="Content", | ||
on_expanded_change=lambda: set_is_expanded( | ||
True if is_expanded == False else False | ||
), | ||
), | ||
ui.text("Expanded" if is_expanded == True else "Collapsed"), | ||
direction="column", | ||
) | ||
|
||
|
||
my_toggle_disclosure = ui_toggle_disclosure() | ||
``` | ||
|
||
## Variants | ||
|
||
```python | ||
from deephaven import ui | ||
|
||
|
||
@ui.component | ||
def ui_disclosure_variants(): | ||
|
||
return [ | ||
ui.disclosure("Or", variant="or"), | ||
ui.disclosure("And", variant="and"), | ||
] | ||
|
||
|
||
my_disclosure_variants = ui_disclosure_variants() | ||
``` | ||
|
||
## Disabled state | ||
|
||
```python | ||
from deephaven import ui | ||
|
||
my_disclosure_disabled = ui.disclosure( | ||
title="Heading", panel="Content", is_disabled=True | ||
) | ||
``` | ||
|
||
## Quiet state | ||
|
||
```python | ||
from deephaven import ui | ||
|
||
my_disclosure_disabled = ui.disclosure(title="Heading", panel="Content", is_quiet=True) | ||
``` | ||
|
||
## Expanded state | ||
|
||
```python | ||
from deephaven import ui | ||
|
||
my_disclosure_disabled = ui.disclosure( | ||
title="Heading", panel="Content", default_expanded=True | ||
) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters