@@ -998,13 +998,13 @@ def __init__(self, value: T):
998998NavbarOptionsPositionT = Literal [
999999 "static-top" , "fixed-top" , "fixed-bottom" , "sticky-top"
10001000]
1001- NavbarOptionsTypeT = Literal ["auto" , "light" , "dark" ]
1001+ NavbarOptionsThemeT = Literal ["auto" , "light" , "dark" ]
10021002
10031003
10041004class NavbarOptions :
10051005 position : NavbarOptionsPositionT
10061006 bg : Optional [str ]
1007- type : NavbarOptionsTypeT
1007+ theme : NavbarOptionsThemeT
10081008 underline : bool
10091009 collapsible : bool
10101010 attrs : dict [str , Any ]
@@ -1015,7 +1015,7 @@ def __init__(
10151015 * ,
10161016 position : MaybeMissing [NavbarOptionsPositionT ] = MISSING ,
10171017 bg : MaybeMissing [str | None ] = MISSING ,
1018- type : MaybeMissing [NavbarOptionsTypeT ] = MISSING ,
1018+ theme : MaybeMissing [NavbarOptionsThemeT ] = MISSING ,
10191019 underline : MaybeMissing [bool ] = MISSING ,
10201020 collapsible : MaybeMissing [bool ] = MISSING ,
10211021 ** attrs : TagAttrValue ,
@@ -1024,13 +1024,13 @@ def __init__(
10241024
10251025 self .position = self ._maybe_default ("position" , position , default = "static-top" )
10261026 self .bg = self ._maybe_default ("bg" , bg , default = None )
1027- self .type = self ._maybe_default ("type " , type , default = "auto" )
1027+ self .theme = self ._maybe_default ("theme " , theme , default = "auto" )
10281028 self .underline = self ._maybe_default ("underline" , underline , default = True )
10291029 self .collapsible = self ._maybe_default ("collapsible" , collapsible , default = True )
10301030
10311031 if "inverse" in attrs :
10321032 warn_deprecated (
1033- "`navbar_options()` does not support `inverse`, please use `type_ ` instead."
1033+ "`navbar_options()` does not support `inverse`, please use `theme ` instead."
10341034 )
10351035 del attrs ["inverse" ]
10361036
@@ -1049,7 +1049,7 @@ def __eq__(self, other: Any):
10491049 return (
10501050 self .position == other .position
10511051 and self .bg == other .bg
1052- and self .type == other .type
1052+ and self .theme == other .theme
10531053 and self .underline == other .underline
10541054 and self .collapsible == other .collapsible
10551055 and self .attrs == other .attrs
@@ -1071,15 +1071,51 @@ def __repr__(self):
10711071def navbar_options (
10721072 position : MaybeMissing [NavbarOptionsPositionT ] = MISSING ,
10731073 bg : MaybeMissing [str | None ] = MISSING ,
1074- type : MaybeMissing [NavbarOptionsTypeT ] = MISSING ,
1074+ theme : MaybeMissing [NavbarOptionsThemeT ] = MISSING ,
10751075 underline : MaybeMissing [bool ] = MISSING ,
10761076 collapsible : MaybeMissing [bool ] = MISSING ,
10771077 ** attrs : TagAttrValue ,
10781078) -> NavbarOptions :
1079+ """
1080+ Configure the appearance and behavior of the navbar.
1081+
1082+ Parameters:
1083+ -----------
1084+ position
1085+ Determines whether the navbar should be displayed at the top of the page with
1086+ normal scrolling behavior (`"static-top"`), pinned at the top (`"fixed-top"`),
1087+ or pinned at the bottom (`"fixed-bottom"`). Note that using `"fixed-top"` or
1088+ `"fixed-bottom"` will cause the navbar to overlay your body content, unless you
1089+ add padding (e.g., `tags.style("body {padding-top: 70px;}")`)
1090+
1091+ bg
1092+ Background color of the navbar (a CSS color).
1093+
1094+ theme
1095+ The navbar theme: either `"dark"` for a light text color (on a **dark**
1096+ background) or `"light"` for a dark text color (on a **light** background). If
1097+ `"auto"` (the default) and `bg` is provided, the best contrast to `bg` is
1098+ chosen.
1099+
1100+ underline
1101+ If `True`, adds an underline effect to the navbar.
1102+
1103+ collapsible
1104+ If `True`, automatically collapses the elements into an expandable menu on
1105+ mobile devices or narrow window widths.
1106+
1107+ **attrs : dict
1108+ Additional HTML attributes to apply to the navbar container element.
1109+
1110+ Returns:
1111+ --------
1112+ NavbarOptions
1113+ A NavbarOptions object configured with the specified options.
1114+ """
10791115 return NavbarOptions (
10801116 position = position ,
10811117 bg = bg ,
1082- type = type ,
1118+ theme = theme ,
10831119 underline = underline ,
10841120 collapsible = collapsible ,
10851121 ** attrs ,
@@ -1121,7 +1157,7 @@ def navbar_options_resolve_deprecated(
11211157 if not isinstance (inverse_old , bool ):
11221158 raise ValueError (f"Invalid `inverse` value: { inverse } " )
11231159
1124- options_old ["type " ] = "dark" if inverse_old else "light"
1160+ options_old ["theme " ] = "dark" if inverse_old else "light"
11251161
11261162 options_user = options_user if options_user is not None else navbar_options ()
11271163
@@ -1136,7 +1172,7 @@ def navbar_options_resolve_deprecated(
11361172 if opt not in options_resolved :
11371173 options_resolved [opt ] = options_old [opt ]
11381174 elif options_old [opt ] != options_resolved [opt ]:
1139- ignored .append ("inverse" if opt == "type " else opt )
1175+ ignored .append ("inverse" if opt == "theme " else opt )
11401176
11411177 if ignored :
11421178 warn_deprecated (
@@ -1237,7 +1273,7 @@ def layout(self, nav: Tag, content: Tag) -> TagList:
12371273 # bslib supports navbar-default/navbar-inverse (which is no longer
12381274 # a thing in Bootstrap 5) in a way that's still useful, especially Bootswatch.
12391275 nav_final .add_class (
1240- "navbar-inverse" if self .navbar_options .type == "dark" else "navbar-default"
1276+ "navbar-inverse" if self .navbar_options .theme == "dark" else "navbar-default"
12411277 )
12421278
12431279 if self .navbar_options .bg :
@@ -1347,8 +1383,8 @@ def navset_bar(
13471383 padding : Optional [CssUnit | list [CssUnit ]] = None ,
13481384 header : TagChild = None ,
13491385 footer : TagChild = None ,
1350- fluid : bool = True ,
13511386 navbar_options : Optional [NavbarOptions ] = None ,
1387+ fluid : bool = True ,
13521388 # Deprecated ----
13531389 position : MaybeMissing [NavbarOptionsPositionT ] = DEPRECATED ,
13541390 bg : MaybeMissing [str | None ] = DEPRECATED ,
@@ -1390,24 +1426,43 @@ def navset_bar(
13901426 be used for top, the second will be left and right, and the third will be
13911427 bottom. If four, then the values will be interpreted as top, right, bottom, and
13921428 left respectively. This value is only used when the navbar is `fillable`.
1429+ header
1430+ UI to display above the selected content.
1431+ footer
1432+ UI to display below the selected content.
1433+ fluid
1434+ ``True`` to use fluid layout; ``False`` to use fixed layout.
1435+ navbar_options
1436+ Configure the appearance and behavior of the navbar using
1437+ :func:`~shiny.ui.navbar_options` to set properties like position, background
1438+ color, and more.
1439+
1440+ `navbar_options` was added in v1.3.0 and replaces deprecated arguments
1441+ `position`, `bg`, `inverse`, `collapsible`, and `underline`.
13931442 position
1443+ Deprecated in v1.3.0. Please use `navbar_options` instead; see
1444+ :func:`~shiny.ui.navbar_options` for details.
1445+
13941446 Determines whether the navbar should be displayed at the top of the page with
13951447 normal scrolling behavior ("static-top"), pinned at the top ("fixed-top"), or
13961448 pinned at the bottom ("fixed-bottom"). Note that using "fixed-top" or
13971449 "fixed-bottom" will cause the navbar to overlay your body content, unless you
13981450 add padding (e.g., ``tags.style("body {padding-top: 70px;}")``).
1399- header
1400- UI to display above the selected content.
1401- footer
1402- UI to display below the selected content.
14031451 bg
1452+ Deprecated in v1.3.0. Please use `navbar_options` instead; see
1453+ :func:`~shiny.ui.navbar_options` for details.
1454+
14041455 Background color of the navbar (a CSS color).
14051456 inverse
1457+ Deprecated in v1.3.0. Please use `navbar_options` instead; see
1458+ :func:`~shiny.ui.navbar_options` for details.
1459+
14061460 Either ``True`` for a light text color or ``False`` for a dark text color.
14071461 collapsible
1408- ``True`` to automatically collapse the navigation elements into an expandable menu on mobile devices or narrow window widths.
1409- fluid
1410- ``True`` to use fluid layout; ``False`` to use fixed layout.
1462+ Deprecated in v1.3.0. Please use `navbar_options` instead; see
1463+ :func:`~shiny.ui.navbar_options` for details.
1464+
1465+ ``True`` to automatically collapse the elements into an expandable menu on mobile devices or narrow window widths.
14111466
14121467 See Also
14131468 --------
0 commit comments