---
title: "styling for true false values"
author: "Yaroslav Shmarov"
date: "2021-01-25"
canonical_url: "https://blog.superails.com/styling-for-true-false-values"
markdown_url: "https://blog.superails.com/styling-for-true-false-values.md"
description: "Add the helper below, and you will be able to style true/false values like this: app/helpers/application_helper.rb: your view:"
tags: ["ruby-on-rails","helpers","bootstrap"]
license: "GNU AGPL v3. Credit Yaroslav Shmarov and link the canonical URL."
---

# styling for true false values

Add the helper below, and you will be able to style `true`/`false` values like this:

![final-result](https://blog.superails.com/assets/2021-01-25-styling-for-true-false-values/boolean-colors.PNG)

app/helpers/application_helper.rb:
```
# boolean green or red

  def boolean_label(value)
    case value
    when true
      text = 'Yes'
      badge_color = 'badge bg-success text-light'
    when false
      text = 'No'
      badge_color = 'badge bg-danger text-light'
    end
    tag.span(text, class: badge_color)
  end
```
your view:
```
= boolean_label(user.confirmed?)
```
