Navigation
Module reahl.web.bootstrap.navbar¶
New in version 3.2.
A Bootstrap Navbar is a header for a web application with all manner of useful content, including a navigation menu.
Navbar¶
-
class
reahl.web.bootstrap.navbar.
Navbar
(view, css_id=None)¶ A bootstrap Navbar can be used as page header in a web application. A Navbar can contain some branding text, a
Nav
and a smallForm
.You populate a Navbar using a NavbarLayout for complete control over how the Navbar is laid out, which of its possible elements are present and how they are composed themselves.
- Parameters
view – (See
reahl.web.fw.Widget
)css_id – (See
reahl.web.fw.Widget
)
NavbarLayout¶
-
class
reahl.web.bootstrap.navbar.
NavbarLayout
(fixed_to=None, center_contents=False, colour_theme=None, bg_scheme=None)¶ Used to populate a Navbar.
- Parameters
fixed_to – May be one of ‘top’,’bottom’ or ‘stickytop’. The Navbar will stick to the top or bottom of the viewport.
center_contents – If True, all the contents of the Navbar is centered within the Navbar itself.
colour_theme – Use ‘light’ for use with light background colors, or ‘dark’ with dark background colors.
bg_scheme – Whether the Navbar should use ‘primary’ colors, a ‘dark’ (light on dark) scheme or a ‘light’ background.
-
customise_widget
()¶ Override this method in subclasses to allow your Layout to change its Widget upon construction. There is no need to call super(), as the superclass implementation does nothing.
-
set_brand_text
(brand_text)¶ Sets the brand to be a link to the home page that contains the given text.
- Parameters
brand_text – Text to use for branding.
-
set_brand
(brand_htmlwidget)¶ Sets brand_widget to be used as branding.
- Parameters
brand_htmlwidget – An
HTMLWidget
to be used as branding.
-
add
(widget)¶ Adds the given Form or Nav widget to the Navbar.
-
add_toggle
(target_html_element, text=None, left_aligned=False)¶ Adds a link that toggles the display of the given target_html_element.
- Parameters
target_html_element – A
HTMLElement
text – Text to be used on the toggle link. If None, the boostrap navbar-toggler-icon is used
left_aligned – If True, ensure that the toggle is to the far left.
ResponsiveLayout¶
-
class
reahl.web.bootstrap.navbar.
ResponsiveLayout
(collapse_below_device_class, center_contents=False, fixed_to=None, align_toggle_left=False, collapse_brand_with_content=False, colour_theme=None, bg_scheme=None, text=None)¶ Makes the Navbar responsive and collapseable depending on the device.
- Parameters
collapse_below_device_class – Which device class should trigger responsive collapsing. Valid values: xs, sm, md, lg, xl
center_contents – If True, all the contents of the Navbar is centered within the Navbar itself.
fixed_to – May be one of ‘fixed-top’,’fixed-bottom’ or ‘sticky-top’. The Navbar will stick to the top or bottom of the viewport.
align_toggle_left – If True align the toggle on the left (the default is to align it right).
collapse_brand_with_content – When set to True, the brand should collapse with the content.
colour_theme – Use ‘light’ for use with light background colors, or ‘dark’ with dark background colors.
bg_scheme – Whether the Navbar should use ‘primary’ colors, a ‘dark’ (light on dark) scheme or a ‘light’ background.
text – Text to be used on the toggle link. If None, the boostrap navbar-toggler-icon is used.
-
customise_widget
()¶ Override this method in subclasses to allow your Layout to change its Widget upon construction. There is no need to call super(), as the superclass implementation does nothing.
Table of Contents
Previous topic
Module reahl.web.bootstrap.navs
Next topic
Package reahl.web.bootstrap.pagination