Andrew
Andrew

Reputation: 149

Aligning the tabs in two rows using .tabset in Rmarkdown

I have the following code and would like the tabs to appear over two rows such that

row 1: `A Plot`, `B Plot`, `C Plot`
row 2: `A Table`, `B Table`, `C Table`

How is this achieved?

---
title: "Untitled"
output: html_document
---

## Plots {.tabset}

### A plot

### B plot
 
### C plot

### A Table           # New line

### B Table

### C Table

Upvotes: 1

Views: 385

Answers (1)

Shafee
Shafee

Reputation: 20087

One option could be using CSS Grid Layout to align the tabs in three column.

---
title: "Tabset in Two Row"
output: html_document
---

```{css, echo=FALSE}

.break .nav-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
}

.break .nav-tabs:before,
.break .nav-tabs:after {
  content: unset;
}
```

## Plots {.tabset .break}

### A plot

### B plot
  
### C plot

### A Table

### B Table

### C Table

tabs in a three column grid layout


Upvotes: 1

Related Questions