API / Entities

ScenarioGroupEntity

Represents a group of preview scenarios within a preview class.

Instance Methods

Annotations

# tags (tag_name = nil) → Array<YardTag>

Collection of tags from each of the scenarios in the group. Can be filtered by tag name by providing the name as an argument.

Arguments:

tag_name Symbol

Optional tag type to filter by

Example:

all_tags = group.tags
display_tags = group.tags(:display)

Display options

# display_options → Hash

Display options hash.

Contains all display options defined via the @display tag for each scenario in the group, merged with any globally-defined options.

Identity

# id → String

Human-readable unique ID for the entity.

# label → String

Titlized name for use in navigation etc.

Can be customized using the @label tag where supported.

# name → String

Parameter-safe entity name.

# type → Symbol

Entity type identifier. Returns :scenario_group for scenario groups.

Paths

# lookup_path → String

Canonical reference path.

Used for generating URL paths and looking up entities.

Aliases:

#path

Render Targets

# render_targets → Array<RenderableEntity>

Collection of render targets (components or partials) from each of the scenarios in the group.

Render targets are guessed where possible (based on the preview class name) but can also be manually specified using the @renders tag.

Example:

"This group renders: #{group.render_targets.map(&:label).join(", ")}"

Aliases:

#components

Scenarios

# scenarios → Array<ScenarioEntity>

Returns all scenarios within the group.

URLs

# inspect_path → String

The inspector URL path for this scenario group.

Aliases:

#url_path
# preview_path → String

The standalone preview URL path for this scenario group.

Visibility

# hidden? → Boolean

Whether or not the entity is hidden (i.e. hidden from navigation).

# visible? → Boolean

Whether or not the entity is visible (i.e. present in navigation).

Other

# preview → PreviewEntity

The preview that this scenario belongs to.

Aliases:

#parent

User Guide

Extending Lookbook

API

Elsewhere