Class: ListComponent

Inherits:
Component show all
Defined in:
app/components/list_component.rb

Overview

List — ordered, unordered, and bulleted lists.

Usage:

List(bulleted: true) { text "items..." }
List(divided: true, relaxed: true) { text "items..." }

Constant Summary

Constants inherited from Component

Component::HTML_OPTIONS

Instance Method Summary collapse

Methods inherited from Component

default, #initialize, #render_in, slot

Constructor Details

This class inherits a constructor from Component

Instance Method Details

#to_sObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/components/list_component.rb', line 22

def to_s
  classes = class_names(
    "ui",
    size,
    { "ordered" => ordered, "bulleted" => bulleted, "divided" => divided,
      "relaxed" => relaxed, "animated" => animated, "horizontal" => horizontal,
      "inverted" => inverted, "celled" => celled, "selection" => selection,
      "link" => link },
    "list"
  )

  if ordered
    tag.ol(class: classes) { @content }
  else
    tag.div(class: classes) { @content }
  end
end