🚨 You are viewing the legacy v1.x docs. See the new v2 documentation →


Represents a single, annotated example method within a ViewComponent preview class.



Unique ID for the example

Type: String

Label for the example, used in navigation

Type: String

Full filesystem path to the parent preview class file

Type: Pathname

URL of the preview example in Lookbook

Type: String

The source code for the example

Type: String

Hash of information about the source language (Ruby or HTML/ERB, depending on whether the example uses a preview template)

Type: Hash

The entity type. Returns :example

Type: Symbol



Returns an array of Tag objects representing all tags that have been applied of the specified type.

If no tag type is provided then all tags are returned.


Optional tag type to filter by - e.g. :todo

Type: Symbol
<ul id="todo-list">
  <% preview_example.tags(:todo).each do |todo| %>
    <li><%= todo.task %></li>
  <% end %>


Returns the first Tag of type <tag_type> that has been applied.


Optional tag type to filter by - e.g. :status

Type: Symbol
<p>Preview status: "<%= preview_example.tag(:status).label %>"</p>