Breeze.Storybook.Story behaviour (Breeze v0.4.0)

Copy Markdown View Source

Defines a Storybook entry.

A story is a normal Breeze.View with a story/0 metadata callback:

defmodule MyApp.ButtonStory do
  use Breeze.Storybook.Story

  def story do
    %{
      id: "button",
      title: "Button",
      description: "Primary action button",
      source: ~s|<.button id="save">Save</.button>|,
      notes: ["Use a view event to handle activation."]
    }
  end

  def render(assigns), do: ~H"<.button id="save">Save</.button>"
end

Story metadata supports :id, :title, :group, :description, :source, :notes, and :variants. A variant is a map with an :id and :label and can override :description, :source, and :notes.

Summary

Callbacks

Returns the metadata used to list and describe the story.

Callbacks

story()

@callback story() :: map()

Returns the metadata used to list and describe the story.