# `PhoenixStorybook.BackendBehaviour`
[🔗](https://github.com/phenixdigital/phoenix_storybook/blob/v1.1.0/lib/phoenix_storybook.ex#L1)

Behaviour implemented by your backend module.

# `config`

```elixir
@callback config(key :: atom(), default :: any()) :: any()
```

Returns a configuration value from your config.exs storybook settings.

`key` is the config key
`default` is an optional default value if no value can be fetched.

# `content_tree`

```elixir
@callback content_tree() :: [
  %PhoenixStorybook.FolderEntry{
    entries: term(),
    icon: term(),
    index: term(),
    name: term(),
    open?: term(),
    path: term()
  }
  | %PhoenixStorybook.StoryEntry{
      icon: term(),
      index: term(),
      name: term(),
      path: term()
    }
]
```

Returns a precompiled tree of your storybook stories.

# `find_entry_by_path`

```elixir
@callback find_entry_by_path(String.t()) ::
  %PhoenixStorybook.FolderEntry{
    entries: term(),
    icon: term(),
    index: term(),
    name: term(),
    open?: term(),
    path: term()
  }
  | %PhoenixStorybook.StoryEntry{
      icon: term(),
      index: term(),
      name: term(),
      path: term()
    }
```

Returns an entry from its absolute storybook path (not filesystem).

# `flat_list`

```elixir
@callback flat_list() :: [
  %PhoenixStorybook.FolderEntry{
    entries: term(),
    icon: term(),
    index: term(),
    name: term(),
    open?: term(),
    path: term()
  }
  | %PhoenixStorybook.StoryEntry{
      icon: term(),
      index: term(),
      name: term(),
      path: term()
    }
]
```

Returns all the nodes (stoires & folders) of the storybook content tree as a flat list.

# `leaves`

```elixir
@callback leaves() :: [
  %PhoenixStorybook.StoryEntry{
    icon: term(),
    index: term(),
    name: term(),
    path: term()
  }
]
```

Returns all the leaves (only stories) of the storybook content tree.

# `storybook_path`

```elixir
@callback storybook_path(atom()) :: String.t()
```

Returns a storybook path from a story module.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
