--- author: "Mark Dumay" title: "Bootstrap Components" date: 2022-12-26 description: "Overview of available Bootstrap components." tags: ["bootstrap"] thumbnail: img/boots.jpg photoCredits: Nathan Dumlao photoSource: Unsplash --- Bootstrap provides several out-of-the-box UI components. The Hinode theme uses several of these components for rendering, such as the navigation menu and scrollspy. A few components are made available as Hugo shortcode, see [Custom Shortcodes]({{< ref "custom-shortcodes" >}} "Custom Shortcodes"). You can embed the Bootstrap components themselves too. The paragraphs below demonstrate the available UI components. ## Accordion The accordion is available as [custom shortcode]({{< ref "custom-shortcodes#accordion" >}} "custom shortcode"). The following shortcode displays an accordion with three items. {{< accordion >}} {{< accordion-item header="Accordion Item #1" class="show" >}} This is the first item's accordion body. It supports HTML content. The item is shown by adding the value show to the class argument. {{< /accordion-item >}} {{< accordion-item header="Accordion Item #2" >}} This is the second item's accordion body. It too supports HTML content. {{< /accordion-item >}} {{< accordion-item header="Accordion Item #3" >}} This is the third item's accordion body. {{< /accordion-item >}} {{< /accordion >}} ## Alerts The alert is available as [custom shortcode]({{< ref "custom-shortcodes#alert" >}} "custom shortcode"). The following shortcode displays a simple alert. {{< alert color="danger" >}} A simple danger alert—check it out! {{< /alert >}} ## Badge Badges can be added to headings and buttons. The following two sections illustrate how to use them. ### Headings Use HTML code to display a badge for a heading. See the Bootstrap [documentation][bs_badge_heading] for more options. The following example displays a badge for a heading of size six. ```html
Example heading New
``` The result looks like this.
Example heading New
### Buttons The badge for a button is available via a [custom shortcode]({{< ref "custom-shortcodes#button" >}} "custom shortcode"). The following example displays a light button with a badge. {{< button color="light" href="#" badge="3" >}} Button {{< /button >}} ## Breadcrumb The breadcrumb is available as [custom shortcode]({{< ref "custom-shortcodes#breadcrumb" >}} "custom shortcode"). The following example displays a breadcrumb for the current page. {{< breadcrumb >}} ## Buttons The button is available as [custom shortcode]({{< ref "custom-shortcodes#button" >}} "custom shortcode"). The following example displays a tooltip for a dark button with a badge. {{< button color="dark" tooltip="Click on the inbox to view your unread messages" href="#" badge="99+" >}} Inbox {{< /button >}} ## Button Group The button group is available as [custom shortcode]({{< ref "custom-shortcodes#button-group" >}} "custom shortcode"). The following example displays a group of three buttons. {{< button-group aria-label="Basic example" >}} {{< button color="primary" href="#" >}}Left{{< /button >}} {{< button color="primary" href="#" >}}Middle{{< /button >}} {{< button color="primary" href="#" >}}Right{{< /button >}} {{< /button-group >}} ## Card The card is available as [custom shortcode]({{< ref "custom-shortcodes#card" >}} "custom shortcode"). The following example displays a card that links to the [Rich Content]({{< ref "rich-content" >}} "Rich Content") page. {{< card path="rich-content" class="col-sm-12 col-lg-8 mx-auto" layout="rich" >}} ## Carousel The carousel is available as [custom shortcode]({{< ref "custom-shortcodes#carousel" >}} "custom shortcode"). The following example displays a centered carousel with three slides, 16x9 aspect ratio, and a relative width of 67% on large screens. {{< carousel ratio="16x9" class="col-sm-12 col-lg-8 mx-auto" >}} {{< img src="img/coffee.jpg" caption="slide 1" >}} {{< img src="img/phone.jpg" caption="slide 2" >}} {{< img src="img/dunes.jpg" caption="slide 3" >}} {{< /carousel >}} ## Close button Use HTML code to display a generic close button. See the Bootstrap [documentation][bs_close_button] for more options. The following example displays a button with default styling. ```html ``` The result looks like this. ## Collapse The collapse panel is available as [custom shortcode]({{< ref "custom-shortcodes#collapse" >}} "custom shortcode"). The following example displays a button that reveils a hidden panel: {{< button collapse="collapse-1" >}} Trigger panel {{< /button >}} {{< collapse id="collapse-1" class="p-3 border rounded" >}} Some placeholder content for the collapse component. This panel is hidden by default but revealed when the user activates the relevant trigger. {{< /collapse >}} ## Dropdowns ### Single button ### Split button
## List group
The current link item A second link item A third link item A fourth link item A disabled link item
## Modal ## Navbar ## Navs & tabs ## Offcanvas Link with href
Offcanvas
Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.
## Pagination ## Placeholders ## Popovers ## Progress
## Scrollspy ### Navbar

First heading

...

Second heading

...

Third heading

...

Fourth heading

...

Fifth heading

...

### Nested nav

Item 1

...

Item 1-1

...

Item 1-2

...

Item 2

...

Item 3

...

Item 3-1

...

Item 3-2

...

### List group

Item 1

...

Item 2

...

Item 3

...

Item 4

...

### Simple anchors

Item 1

...

Item 2

...

Item 3

...

Item 4

...

Item 5

...

## Spinners The spinner is available as [custom shortcode]({{< ref "custom-shortcodes#spinner" >}} "custom shortcode"). The following example displays a centered spinner: {{< spinner color="info" class="text-center" >}} Loading... {{< /spinner >}} ## Toasts The toast is available as [custom shortcode]({{< ref "custom-shortcodes#toast" >}} "custom shortcode"). The following example displays a button that triggers a toast message: {{< button id="toastButton" >}} Show toast {{< /button >}} {{< toast >}} This is a toast message. {{< /toast >}} ## Tooltips The tooltip is available as [custom shortcode]({{< ref "custom-shortcodes#tooltip" >}} "custom shortcode"). The following example displays a tooltip for a colored hyperlink: {{< tooltip color="warning" title="Tooltip" href="#" >}} Tooltip demonstration {{< /tooltip >}} [bs_badge_heading]: https://getbootstrap.com/docs/5.2/components/badge/#headings [bs_close_button]: https://getbootstrap.com/docs/5.2/components/close-button/