# `PhoenixStorybook.Index`
[🔗](https://github.com/phenixdigital/phoenix_storybook/blob/v1.3.0/lib/phoenix_storybook/stories/index.ex#L1)

An index is an optional file you can create in every folder of your storybook content tree to
improve rendering of the storybook sidebar.

The index files can be used:
  - to customize the folder itself: name, icon, index and opening status.
  - to customize folder direct children (only stories): name, icon and index.

Sidebar entries are sorted alphabetically unless a numerical index is specified in the index file,
either for the folder itself or for its entries.
If no index has been set, all folders are placed at the end, sorted in alphabetical order.

Indexes must be created as `index.exs` files.

Read the [icons](guides/icons.md) guide for more information on custom icon usage.

## Usage

```elixir
# storybook/_components.index.exs
defmodule MyAppWeb.Storybook.Components do
  use PhoenixStorybook.Index

  def folder_name, do: "My Components"
  def folder_icon, do: {:fa, "icon"}
  def folder_open?, do: true
  def folder_index, do: 0

  def entry("a_component"), do: [name: "My Component", index: 1]
  def entry("other_component"), do: [name: "Another Component", icon: {:fa, "icon", :thin}, index: 0]
end
```

# `__using__`
*macro* 

Convenience helper for using the functions above.

---

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