Matestack Ui Bootstrap
AboutMatestack Ui CoreMatestack Ui VueJsMatestack Ui Bootstrap
2.1
2.1
  • Welcome
  • Getting Started
    • Installation & Update
    • Quick Start [WIP]
  • API
    • Templates
      • Apps
        • Admin App Template
    • Form
      • Checkbox
      • Input
      • Radio
      • Select
      • Submit
      • Switch
    • Components
      • Accordion
      • Alert
      • Badge
      • Breadcrumb
      • Button
      • ButtonGroup
      • Card
      • Carousel
      • Chart
      • Close
      • Collapse
      • Dropdown
      • ListGroup
      • Modal
      • Nav
      • Navbar
      • Pagination
      • Popover
      • Progress
      • Scrollspy
      • Smart collection
      • Spinner
      • Toast
      • Tooltip
    • Layout
      • Container
      • Col
      • Row
  • Integrations
    • Chart.js
    • Flatpickr
    • Devise
Powered by GitBook
On this page
  • bs_breadcrumb(*args, &block)
  • Examples
  • Simple breadcrumb with transitions
  • Breadcrumb with one transition and one link
  1. API
  2. Components

Breadcrumb

The Bootstrap breadcrumb component, implemented in Ruby. Use it like any other matestack component in your apps, pages and components. It offers customizable options to simply achieve what is possible in bootstrap with this component. See below for more information about the possible options.

bs_breadcrumb(*args, &block)

Returns a bootstrap breadcrumb containing content created from an array of items and/or content specified by a block. The breadcrumb is customizable with the following options.

Optional options

  • :items - Expects an array of hashes. Each hash represents an item and is required to contain at least :path and :text keys. The items will be rendered as transitions with all attributes from the hash injected into the transition component. In case you want links instead of transitions add a type: :link to the item which should be rendered as link. If items are given and a block the items are rendered before the block.

  • :nav_class - Expects a string. Use :nav_class to add custom classes to the sourrounding "nav".

  • &block - Use a block to create custom content/markup inside a breadcrumb. If used together with :text the text will be displayed before the block.

  • Html attributes - all w3c confirm html attributes for ol's can be set via options and will be added to the items and block surrounding breadcrumb ol element which is in bootstrap surrounded by a nav.

Examples

Simple breadcrumb with transitions

items = [
  { path: root_path, text: 'Home' },
  { text: 'Products' },
]
bs_breadcrumb items: items, class: 'my-breadcrumb'

Result:

<nav aria-label="breadcrumb">
  <ol class="breadcrumb my-breadcrumb">
    <li class="breadcrumb-item">
      <a href="/">Home</a><!-- transition link -->
    </li>
    <li class="breadcrumb-item active" aria-current="page">
      Products
    </li>
  </ol>
</nav>

Breadcrumb with one transition and one link

items = [
  { path: root_path, text: 'Home', type: :link },
  { path: products_path, text: 'Products' },
  { text: "Product A" }
]
bs_breadcrumb items: items, class: 'my-breadcrumb'

Result:

<nav aria-label="breadcrumb">
  <ol class="breadcrumb my-breadcrumb">
    <li class="breadcrumb-item">
      <a href="/">Home</a><!-- link -->
    </li>
    <li class="breadcrumb-item">
      <a href="/products">Products</a><!-- transition link -->
    </li>
    <li class="breadcrumb-item active" aria-current="page">
      Product A
    </li>
  </ol>
</nav>
PreviousBadgeNextButton

Last updated 3 years ago