# Carousel slider

## 👉 **The Tag** <a href="#the-tag" id="the-tag"></a>

Slides a collection of containers horizontally. The slider can have different animations, depending on the tag placed (see section below).

**📍 Where to add the tag:** A second-level container

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mflvfuy22LbdBGZFHhd%2F-MflwVsZqRxBIJfuJQnP%2Fslider-horizontal-final.gif?alt=media\&token=e27f7c43-0427-4c0e-875c-b04742b1fec6)

## 🏷️ Animation Tags

Each tag is a different animation. In the tabs below you can discover all of them!

{% tabs %}
{% tab title="Default" %}

```
[container:slider:default]
```

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-MfmtXi8oVq8J3ET3D_z%2F-MfmtcDaX5FCHhLViKky%2Fslider-default-finalsq.gif?alt=media\&token=d5b29c59-b466-4b43-b814-8321ff34dded)
{% endtab %}

{% tab title="Crossfade" %}

```
[container:slider:crossfade]
```

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-MfmtXi8oVq8J3ET3D_z%2F-MfmuICslTVjcPQaThcd%2Fslider-crossfade-finalsq.gif?alt=media\&token=ddaace41-bc41-4a0f-8ede-724377654e2d)
{% endtab %}

{% tab title="Cube" %}

```
[container:slider:cube]
```

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-MfmtXi8oVq8J3ET3D_z%2F-Mfmw5zRzLqWB1SX4yGq%2Fslider-cube-finalsq.gif?alt=media\&token=aa6d7b8c-6f1e-40b4-b6ea-eda0082a9345)
{% endtab %}

{% tab title="Pager" %}

```
[container:slider:pager]
```

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-MfmtXi8oVq8J3ET3D_z%2F-MfmwCMDm14-BmN-jEAv%2Fslider-pager-finalsq.gif?alt=media\&token=ef07e359-95af-437b-a5b8-8402fdee9bfb)
{% endtab %}

{% tab title="Parallax" %}

```
[container:slider:parallax]
```

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-MfmtXi8oVq8J3ET3D_z%2F-MfmwGuWkHDSYohxGA4W%2Fslider-parallax-finalsq.gif?alt=media\&token=e42b7e25-1da2-4c33-a18b-dead644a9537)
{% endtab %}

{% tab title="Rotate" %}

```
[container:slider:rotate]
```

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-MfmtXi8oVq8J3ET3D_z%2F-MfmwLd1jTGF14XuY4Rj%2Fslider-rotate-finalsq.gif?alt=media\&token=09e9bc2f-2234-4409-8a61-705899c0337f)
{% endtab %}

{% tab title="Zoom" %}

```
[container:slider:zoom]
```

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-MfmtXi8oVq8J3ET3D_z%2F-MfmwQMtPAGd3YJ-OuQ8%2Fslider-zoom-finalsq.gif?alt=media\&token=7f53bfc2-de21-48ca-bd98-3b8eec5b4992)
{% endtab %}

{% tab title="Horizontal" %}

```
[container:slider:horizontal]
```

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-MfmtXi8oVq8J3ET3D_z%2F-MfmwVuomkxrfb7zSm0R%2Fslider-horizontal-finalsq.gif?alt=media\&token=3630eda3-7d32-4fd8-a6c6-1f7481365c81)
{% endtab %}
{% endtabs %}

## 🏷️ Optional Tags

You can add as many of these tags as you want to the slider container.

{% tabs %}
{% tab title="Slider Indicator" %}

```
[slider-indicator:#FFFFFFFF]
```

```
[slider-indicator:<active_color>:<inactive_color>]
```

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-MfmwYZ6l1TDtpwFH8G0%2F-Mfmxc1PLw9Ruqd1v_x4%2Fslider-indicator-final.png?alt=media\&token=75f7cc6e-7519-4803-98e4-8805f024e05e)

Adds a dots indicator at the bottom of the slide container, with the specified color (use 8-digit HEX code - alpha included). \
\
You can also specify a color for the active item and another color for the inactive ones.

**📍 Where to add the tag:** on the same layer as the <mark style="color:red;">`[container:slider]`</mark> tag.\
\
For example \[slider-indicator:] needs to be:

\[slider-indicator:#FFFF0000:#FF00FF00]. \
For #FF0000 and #00FF00, we add FF at the beginning to set alpha at 1 (no transparency).

{% hint style="warning" %}
This tag is supported for all slider animations except for <mark style="color:red;">`[container:slider:horizontal]`</mark>.
{% endhint %}
{% endtab %}

{% tab title="Infinite slide" %}

```
[slider-infinite]
```

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-MfmwYZ6l1TDtpwFH8G0%2F-Mfmy5E-1V21iEGNM9oD%2Fslider-infinite-final.gif?alt=media\&token=71823848-9873-4a34-a5fa-b25145a31e34)

After the last slide, the first slide will be shown, so user can swipe in one direction infinitely.

**📍 Where to add the tag:** on the same layer as the <mark style="color:red;">`[container:slider]`</mark> tag.
{% endtab %}

{% tab title="Automatic slide" %}

```
[slider-automatic:<time-in-seconds>]
```

Slider will move automatically **every x seconds**.

For example: 8 seconds <mark style="color:red;">`[slider-automatic:8]`</mark>

**📍 Where to add the tag:** on the same layer as the <mark style="color:red;">`[container:slider]`</mark> tag.
{% endtab %}
{% endtabs %}

{% hint style="info" %}
You can also add the tags <mark style="color:red;">`[action:prev-slide]`</mark>and <mark style="color:red;">\[action:next-slide]</mark> to any design element (i.e. buttons) for easy navigation between slides.
{% endhint %}

## 🏷️ **How to add the tag** <a href="#how-to-add-the-tag" id="how-to-add-the-tag"></a>

1. Create a slide design with your slides lined up next to each other horizontally, with each "slide" in its separate container. If you want to connect your slider to a list of data from API, see **step 5**.

{% hint style="info" %}
Only the <mark style="color:red;">`[container:slider:horizontal]`</mark> (i.e. horizontal scroll) allows for slides that are smaller than the width of the screen. All other slide effects must have individual slides that stretches the full width of the screen.
{% endhint %}

![If your design has slides smaller than the width of the screen, use \[container:slider:horizontal\]. ](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mg5D75tnyrVfC0qRyic%2F-Mg5G4l_1pJTO7Ky-YKy%2FScreenshot_2020-09-09_at_17.29.55.png?alt=media\&token=664c660f-21f1-443d-8851-a53078cb2fd2)

2\. **Create a container around the slider design** that contains all of your slides and is the full width of the screen. Similar to how you set up overflow behaviour for Figma prototype.

![Container setup for slides the full width of the app screen.](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mg5GU3-uDHFwwObb2qm%2F-Mg5Ggx3sQY0A2MSio1_%2FScreenshot_2020-09-09_at_17.34.33.png?alt=media\&token=2e1cf566-c8cd-4d81-9501-847cbe48000f)

![Container setup for slides smaller than the width of the app screen.](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mg5GU3-uDHFwwObb2qm%2F-Mg5GpIWe3TlvF61xlFN%2FScreenshot_2020-09-09_at_17.35.55.png?alt=media\&token=dcb824e9-3c43-465a-9b33-48f75d95de59)

3\. Paste the slide animation Tag of your choice to the layer name of this container.

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mg5GU3-uDHFwwObb2qm%2F-Mg5HNR38KhSwLv7_61S%2Fslider-figma1.gif?alt=media\&token=b7f80958-7869-45ea-8b2a-2309f9a033e9)

4\. Import to Bravo & preview on Bravo Vision 🚀

5\. If you want to connect API data to your slider, you only need to create the first slide as a placeholder design.

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mg5GU3-uDHFwwObb2qm%2F-Mg5I2RqnemftqYC5eLs%2FScreenshot_2020-09-09_at_17.45.18.png?alt=media\&token=f4b82788-1d1c-4080-b6b3-d76160ae9127)

6\. Then connect your list of data the same way you would with a vertical scrolling list ([tutorial here](https://docs.bravostudio.app/data-binding/display-data-in-your-app/data-biding-bind-data-to-ui-for-a-list-page)). However, you need to connect the data array to the **individual slide element**, rather than the slider container.

![Connect the list request to the "Container" property of the slide element highlighted in blue.](https://s3.eu-central-1.amazonaws.com/trengo/media/inline_image_72445_mBlRrkJzcKWYqSZRUmkc0UQZd7zAA8bkCNMETyLt_1652180692131.1652180692131.png)

7\. If you want each slide to open another page, make sure you link the individual slide element to the other page.

![](https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mg5GU3-uDHFwwObb2qm%2F-Mg5MZHAWWPjUPfKqaqK%2FScreenshot_2020-09-09_at_18.12.29.png?alt=media\&token=0403d755-d9d0-4e59-97c6-8fd8ab88040c)

8\. Preview on Bravo Vision 🚀

{% hint style="danger" %}
You cannot use the \[flexo] tag in a slider, as all slides need to have the same fixed size.
{% endhint %}

## 💾 Example files <a href="#example-files" id="example-files"></a>

Duplicate the files below to see how to set it up!

{% embed url="<https://www.figma.com/community/file/982167580060315188>" %}

{% file src="<https://1444025092-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MXpqEanvOhm8vMtIH8i%2F-Mg5GU3-uDHFwwObb2qm%2F-Mg5PeS1hM5OzUeo4glv%2FBravo%20Sample%20-%20Horizontal%20Sliders.xd.zip?alt=media&token=f50705aa-443c-4831-b66f-0439e9f3eb17>" %}
Bravo Sample - Horizontal Sliders.xd
{% endfile %}
