@@ -1115,8 +1115,6 @@ def nav_menu(
11151115# Value boxes
11161116# ======================================================================================
11171117def value_box (
1118- title : TagChild ,
1119- value : TagChild ,
11201118 * ,
11211119 showcase : Optional [TagChild ] = None ,
11221120 showcase_layout : ui ._valuebox .SHOWCASE_LAYOUTS_STR
@@ -1134,16 +1132,14 @@ def value_box(
11341132
11351133 This function wraps :func:`~shiny.ui.value_box`.
11361134
1137- An opinionated (:func:`~shiny.ui.card`-powered) box, designed for
1138- displaying a `value` and `title`. Optionally, a `showcase` can provide for context
1139- for what the `value` represents (for example, it could hold an icon, or even a
1135+ An opinionated (:func:`~shiny.ui.card`-powered) box, designed for displaying a title
1136+ (the 1st child), value (the 2nd child), and other explanation text (other children,
1137+ if any). Optionally, a `showcase` can provide for context for what the `value`
1138+ represents (for example, it could hold an icon, or even a
11401139 :func:`~shiny.ui.output_plot`).
11411140
11421141 Parameters
11431142 ----------
1144- title,value
1145- A string, number, or :class:`~htmltools.Tag` child to display as
1146- the title or value of the value box. The `title` appears above the `value`.
11471143 showcase
11481144 A :class:`~htmltools.Tag` child to showcase (e.g., an icon, a
11491145 :func:`~shiny.ui.output_plot`, etc).
@@ -1184,7 +1180,6 @@ def value_box(
11841180 """
11851181 return RecallContextManager (
11861182 ui .value_box ,
1187- args = (title , value ),
11881183 kwargs = dict (
11891184 showcase = showcase ,
11901185 showcase_layout = showcase_layout ,
@@ -1400,3 +1395,90 @@ def panel_absolute(
14001395 ** kwargs ,
14011396 ),
14021397 )
1398+
1399+
1400+ # ======================================================================================
1401+ # Tooltips and popovers
1402+ # ======================================================================================
1403+
1404+
1405+ def tooltip (
1406+ * ,
1407+ id : Optional [str ] = None ,
1408+ placement : Literal ["auto" , "top" , "right" , "bottom" , "left" ] = "auto" ,
1409+ options : Optional [dict [str , object ]] = None ,
1410+ ** kwargs : TagAttrValue ,
1411+ ) -> RecallContextManager [Tag ]:
1412+ """
1413+ Context manager for a tooltip
1414+
1415+ This function wraps :func:`~shiny.ui.tooltip`.
1416+
1417+ Display additional information when focusing (or hovering over) a UI element.
1418+
1419+ Parameters
1420+ ----------
1421+ id
1422+ A character string. Required to reactively respond to the visibility of the
1423+ tooltip (via the `input[id]` value) and/or update the visibility/contents of the
1424+ tooltip.
1425+ placement
1426+ The placement of the tooltip relative to its trigger.
1427+ options
1428+ A list of additional [Bootstrap
1429+ options](https://getbootstrap.com/docs/5.3/components/tooltips/#options).
1430+ """
1431+
1432+ return RecallContextManager (
1433+ ui .tooltip ,
1434+ kwargs = dict (
1435+ id = id ,
1436+ placement = placement ,
1437+ options = options ,
1438+ ** kwargs ,
1439+ ),
1440+ )
1441+
1442+
1443+ def popover (
1444+ * ,
1445+ title : Optional [TagChild ] = None ,
1446+ id : Optional [str ] = None ,
1447+ placement : Literal ["auto" , "top" , "right" , "bottom" , "left" ] = "auto" ,
1448+ options : Optional [dict [str , object ]] = None ,
1449+ ** kwargs : TagAttrValue ,
1450+ ) -> RecallContextManager [Tag ]:
1451+ """
1452+ Context manager for a popover
1453+
1454+ This function wraps :func:`~shiny.ui.popover`.
1455+
1456+ Display additional information when clicking on a UI element (typically a
1457+ button).
1458+
1459+ Parameters
1460+ ----------
1461+ title
1462+ A title to display in the popover. Can be a character string or UI elements
1463+ (i.e., tags).
1464+ id
1465+ A character string. Required to reactively respond to the visibility of the
1466+ popover (via the `input[id]` value) and/or update the visibility/contents of the
1467+ popover.
1468+ placement
1469+ The placement of the popover relative to its trigger.
1470+ options
1471+ A list of additional [Bootstrap
1472+ options](https://getbootstrap.com/docs/5.3/components/popovers/#options).
1473+ """
1474+
1475+ return RecallContextManager (
1476+ ui .popover ,
1477+ kwargs = dict (
1478+ title = title ,
1479+ id = id ,
1480+ placement = placement ,
1481+ options = options ,
1482+ ** kwargs ,
1483+ ),
1484+ )
0 commit comments