Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: item #531

Merged
merged 8 commits into from
Jun 25, 2024
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions plugins/ui/src/deephaven/ui/components/item.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
from typing import Any, Union
from __future__ import annotations
from typing import Any, Union, List

from ..elements import BaseElement
from ..types import Stringable
from .._internal.utils import create_props
from .basic import component_element

ItemElement = BaseElement
Item = Union[Stringable, ItemElement]
ItemList = List[Item]


def item(*children: Stringable, **props: Any) -> ItemElement:
def item(
*children: Stringable,
title: str | None = None,
text_value: str | None = None,
aria_label: str | None = None,
child_items: ItemList | None = None,
has_child_items: bool | None = None,
ethanalvizo marked this conversation as resolved.
Show resolved Hide resolved
**props: Any,
) -> ItemElement:
"""
An item that can be added to a menu, such as a picker

Args:
children: The options to render within the item.
title: Rendered contents of the item if `children` contains child items.
text_value: A string representation of the item's contents, used for features like typeahead.
aria_label: An accessibility label for this item.
child_items: A list of child items objects. Used for dynamic collections.
has_child_items: Whether this item has children, even if not loaded yet.
**props: Any other Item prop.
"""
children, props = create_props(locals())
return component_element("Item", *children, **props)
Loading