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


Represents an annotated ViewComponent preview class.



Unique ID for the preview

Type: String

Label for the preview, used in navigation

Type: String

Unique preview reference path.

Type: String

URL path of the preview

Type: String

Absolute filesystem path to the preview class file

Type: Pathname

Array of all the preview examples defined in the preview class

Type: Array

Array of all the components used in the preview - usually just one!

Type: Array

The first (and normally only) component used in the preview

Type: Component

The entity type. Returns :preview

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.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.tag(:status).label %>"</p>