@@ -1115,8 +1115,6 @@ def nav_menu(
1115
1115
# Value boxes
1116
1116
# ======================================================================================
1117
1117
def value_box (
1118
- title : TagChild ,
1119
- value : TagChild ,
1120
1118
* ,
1121
1119
showcase : Optional [TagChild ] = None ,
1122
1120
showcase_layout : ui ._valuebox .SHOWCASE_LAYOUTS_STR
@@ -1134,16 +1132,14 @@ def value_box(
1134
1132
1135
1133
This function wraps :func:`~shiny.ui.value_box`.
1136
1134
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
1140
1139
:func:`~shiny.ui.output_plot`).
1141
1140
1142
1141
Parameters
1143
1142
----------
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`.
1147
1143
showcase
1148
1144
A :class:`~htmltools.Tag` child to showcase (e.g., an icon, a
1149
1145
:func:`~shiny.ui.output_plot`, etc).
@@ -1184,7 +1180,6 @@ def value_box(
1184
1180
"""
1185
1181
return RecallContextManager (
1186
1182
ui .value_box ,
1187
- args = (title , value ),
1188
1183
kwargs = dict (
1189
1184
showcase = showcase ,
1190
1185
showcase_layout = showcase_layout ,
@@ -1400,3 +1395,90 @@ def panel_absolute(
1400
1395
** kwargs ,
1401
1396
),
1402
1397
)
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