> For the complete documentation index, see [llms.txt](https://docs.matestack.io/matestack-ui-bootstrap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.matestack.io/matestack-ui-bootstrap/2.1/api/components/tab_nav.md).

# Nav

The Bootstrap `nav` 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_tab_nav(*args, &block)`

Returns a bootstrap tab nav. Also the nav is customizable with the following options.

**Required options**

* `id`

**Optional options**

* `items` - expects an array with hashes with `id`, `text`, `active` as possible keys
  * Set `active` to true, if the current item is the active element
* `variant` - Either `:tabs` or `:pills`
* `fill` - If set true, all available space will be filled proportionately with your *.nav-items*
* `justified` - If set true, all horizontal space will be occupied by nav links, but unlike the *.nav-fill* above, every nav item will be the same width.
* `vertical` - If set true, navigation items will be stacked up
* `horizontal` - Change the horizontal alignment of your nav with flexbox utilities. By default, navs are left-aligned, but you can easily change them to `:center` or `:right` aligned.
* `vertical_up_to_sm` - If set to to true, responsive utility classes are applied for desired responsive behavior
* `vertical_up_to_md` - If set to to true, responsive utility classes are applied for desired responsive behavior
* `vertical_up_to_xl` - If set to to true, responsive utility classes are applied for desired responsive behavior
* Html attributes - all w3c confirm html attributes for div's can be set via options and will be added to the surrounding nav div.

## `bs_tab_nav_content(*args, &block)`

**Required options**

* `id`, need to match desired tab trigger button

**Optional options**

* `active`, set `active` to true, if the current item is the active element

## Examples

### Example 1: Basic tab navigation with pills

```ruby
def response
  bs_tab_nav tab_nav_config do
    bs_tab_nav_content id: :a, active: true do
      plain "A"
    end
    bs_tab_nav_content id: :b do
      plain "B"
    end
    bs_tab_nav_content id: :c do
      plain "C"
    end
  end
end

def tab_nav_config
  {
    id: "navigation",
    items: [
      { id: :a, text: "Tab A", active: true},
      { id: :b, text: "Tab B" },
      { id: :c, text: "Tab C" }
    ],
    variant: :pills,
    class: "mb-5"
  }
end
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.matestack.io/matestack-ui-bootstrap/2.1/api/components/tab_nav.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
