README.md

# Phosphor LiveView

Phosphor LiveView provides typed Phoenix components for the entire [Phosphor icon set](https://phosphoricons.com/). Icons are bundled as compile-time SVG data, so no runtime generators or asset pipelines, and render directly inside HEEx/LiveView templates.

Phosphor itself is an icon family by [Tobias Fried](https://github.com/rektdeckard) with 1512 glyphs across six weights (Thin, Light, Regular, Bold, Fill, Duotone). Every icon is drawn on a 16x16 px grid with stroke data preserved for downstream tweaking. See the full catalogue at [phosphoricons.com](https://phosphoricons.com).

**PhosphorIcons Version:** 2.1.0

## Installation

```elixir
def deps do
  [
    {:phosphor_live_view, "~> 0.1.0"}
  ]
end
```

## Usage

### Static helpers

```heex
<Phosphor.airplane class="h-6 w-6" />
<Phosphor.airplane weight="bold" class="h-6 w-6" />
```

### Dynamic rendering

```heex
<Phosphor.icon name="airplane" weight="duotone" class="h-6 w-6" />
```

### Passing attributes

Any additional assigns are forwarded to the `<svg>` element.

```heex
<Phosphor.airplane
  id="my-airplane"
  class="inline-block h-5 w-5"
  stroke-width="1.5"
/>
```

If you provide `aria-label`, the component keeps it. Otherwise it adds `aria-hidden="true"` with `role="img"` by default.

## Integrating with your components

```elixir
# core_components.ex
attr :name, :string, required: true
attr :weight, :string, default: "regular"
attr :class, :string, default: "icon"
attr :rest, :global

def icon(assigns) do
  ~H"""
  <Phosphor.icon name={@name} weight={@weight} class={@class} {@rest} />
  """
end
```

Then use it anywhere:

```heex
<.icon name="airplane" class="text-gray-500" />
```

## Regenerating icons

SVG sources live under `priv/phosphor_icons/raw/<weight>/`. To rebuild the compile-time manifest run:

```bash
mix phosphor.gen
```

## Acknowledgements
This library was inspired by Christian Pagsuyoin’s [lucide_live_view](https://github.com/cspags/lucide_live_view) and Max Veytsman’s [heroicons_elixir](https://github.com/mveytsman/heroicons_elixir) work.

## License

Source code is available under the [MIT License](LICENSE).