> For the complete documentation index, see [llms.txt](https://docs.cwicly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cwicly.com/blocks/filter/style-a-filter-example.md).

# Style a Filter (example)

First you need to create a filter:

{% content-ref url="/pages/ONQqXEvmuJVJFWWtd0Qc" %}
[Create a Filter](/blocks/filter/create-a-filter.md)
{% endcontent-ref %}

Now we need to Style the Filter Titles.

{% embed url="<https://youtu.be/REZx7Ffgv9s?feature=shared&t=233>" %}

* In the Typography tab of the Primary tab, set an appropriate font size and weight.

​

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FhBdTDNz6HU9O0JafLono%2FScreenshot%202023-08-16%20at%2011.34.56.png?alt=media&#x26;token=e149f260-2114-4397-92a6-ab7aad9a8a97" alt=""><figcaption></figcaption></figure>

* In the Design tab, open the Borders tab and the Radius and Border tab.
* Set a 40px equal Radius or as required to give a suitable oval look.
* Set an appropriate Border colour, in this example dark grey.
* Set a solid border Style with an equal 1px Width.

​Set an appropriate Padding to allow the items to breathe.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FYX1gflVPEUALz53Hf4Ae%2FScreenshot%202023-08-16%20at%2011.37.59.png?alt=media&#x26;token=ba665949-9417-49b5-bbc8-e35abbe7930e" alt=""><figcaption></figcaption></figure>

Set an appropriate padding to allow the items to breathe.

* In the Design tab, open the Margin and Padding tab and set an upper and lower 10px Padding and a 30px right and left Padding or as required.

​

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FLJ4MNylmPyFv6JssTqwg%2FScreenshot%202023-08-16%20at%2011.41.00.png?alt=media&#x26;token=705fdf21-7a1d-4f60-b3f3-39a7ab111960" alt=""><figcaption></figcaption></figure>

### Relative Styling for button selection <a href="#relative-styling-for-button-selection" id="relative-styling-for-button-selection"></a>

Now we have fully set up the Filter buttons but to make it easier for the User, we can add a colour change to the current button to let them know what category is selected.

* With the Filter block selected, open the Design tab and the Relative Styling tab.
* Click the "+" icon to add a new Relative Style.

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FLzexXZKotHmq8rRCdcby%2FScreenshot%202023-08-16%20at%2011.47.17.png?alt=media&#x26;token=bf0e0080-889c-4c16-92dc-c9b428283c80" alt=""><figcaption></figcaption></figure>

We need to set the Rules under which this change will occur.

* Click the "Rules" icon to open the Relative Styles Rules modal.
* Input a suitable Name, in this example "Selected".

<br>

<figure><img src="https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FDiuKnmSLfS9TkbTHxYdC%2FScreenshot%202023-08-16%20at%2011.51.39.png?alt=media&amp;token=bd475cb2-a7d9-467d-b643-f9d8ae090d81" alt=""><figcaption></figcaption></figure>

* In  "Rules after block class" set Combinator to "Descendent".

<figure><img src="https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2F65E1jYa3Gzccz5aFFERs%2FScreenshot%202023-08-16%20at%2011.55.20.png?alt=media&amp;token=5a540d05-3698-4336-8172-16afa5f362e0" alt=""><figcaption></figcaption></figure>

* Set Type to Class.

<figure><img src="https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2F1zOVZMw447oyWyBNC3Dm%2FScreenshot%202023-08-16%20at%2011.56.34.png?alt=media&amp;token=e5f660f1-c425-42da-ae26-739b3fac0b64" alt=""><figcaption></figcaption></figure>

* Input "selected" as Selector since we wish the rule to apply to the selected filter item.
* Click Create "selected" to create.

<figure><img src="https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FGDDgR014nIWm4lybsyoh%2FScreenshot%202023-08-16%20at%2011.58.56.png?alt=media&amp;token=d7300e44-7ee7-40b0-948d-911742f7c198" alt=""><figcaption></figcaption></figure>

We want to add another Rule to target the selected paragraph.

* Click the "+" icon in  Rules after block class.

<figure><img src="https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FQL7NsBbE58exZsY2mwlo%2FScreenshot%202023-08-16%20at%2011.59.44.png?alt=media&amp;token=0c7f106e-ab38-44b6-a5d2-c9381ab523dd" alt=""><figcaption></figcaption></figure>

* Set Combinator to Descendant.

<figure><img src="https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FS4ghcKp9tEVk7LFYnnDr%2FScreenshot%202023-08-16%20at%2012.00.47.png?alt=media&amp;token=12d7285b-b172-43f8-9fb9-f141b895ef7f" alt=""><figcaption></figcaption></figure>

* Set Type to Class.

<figure><img src="https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FWedzDUArKxwCzeIIGyEc%2FScreenshot%202023-08-16%20at%2012.02.05.png?alt=media&amp;token=edc98f68-d41e-4722-938e-81a5c65a54cb" alt=""><figcaption></figcaption></figure>

* In the Navigator, right click on the Paragraph block contained inside the Filter block and copy the Class.

<figure><img src="https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2Fq4fa0q4qxMFXdynCGaWm%2FScreenshot%202023-08-16%20at%2012.02.48.png?alt=media&amp;token=54720159-c7e0-4514-b7e1-fb78a54a7a62" alt=""><figcaption></figcaption></figure>

* Paste the copied paragraph class into the Selector field.

<figure><img src="https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FjBkCItPq1Nw0CSbInnls%2FScreenshot%202023-08-16%20at%2012.07.29.png?alt=media&amp;token=948048c6-a2f1-4374-924a-efeace6c70da" alt=""><figcaption></figcaption></figure>

It's time to style the relative styling we set up.

* In the Design tab, open the Relative styling tab.
* Click the required Relative Style you wish to customise, in this example "Selected".

![](https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FGRVmVY2FNd5R3CnPklU4%2FScreenshot%202023-08-17%20at%2010.48.51.png?alt=media\&token=74d99a07-3864-4556-ba21-4fabd5e21fc1)

In this example we want the white background to become black when selected.

* In the Background tab, open the colours tab and choose a suitable background colour, in this example Black.

![](https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FmfP9JkhEDMnjrXpLjQvv%2FScreenshot%202023-08-17%20at%2010.50.52.png?alt=media\&token=d910c287-8f3a-4310-b86f-ac154066847c)

Let's style the text. In this example we want the text to change white when selected.

* In the Typography tab, select a suitable Text colour, in this example white.

![](https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2Fmke402Q0Bsxm8kzCKG01%2FScreenshot%202023-08-17%20at%2010.52.16.png?alt=media\&token=c689b85a-10de-43ea-8222-138b47131261)

Now when a user selects a filter button, the background will turn black and the text white.

<figure><img src="https://3250709389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MS33S0eoYwMaMrLb7T_%2Fuploads%2FjlQbjv0QEUxeHZ26zKcr%2FScreenshot%202023-08-17%20at%2010.54.46.png?alt=media&amp;token=1179f99c-e712-467a-acbd-0097b854f680" alt=""><figcaption></figcaption></figure>
