Petal CLI

Components are installed into your project's lib/[app_name_web]/components/ , directory giving you full control over the code

You can now modify and customize components to meet your unique needs

Project Motivation

shadcn-ui set the gold standard for component libraries. They provide beautiful components, and still allow you full, easy control and customization.

It's time to bring those same capabilities to Phoenix and LiveView, starting with the beautiful components from Petal Framework

Installation

You can install Petal CLI either globally or as a project dependency.

Global Installation

To install Petal CLI globally, use the following command:

mix archive.install hex petal_cli

Local Installation

To install Petal CLI as a project dependency, add it to your mix.exs file:

def deps do
  [
    {:petal_cli, "~> 0.1", only: :dev}
  ]
end

Then run:

mix deps.get

Usage

mix petal.install [options] [component names]

Options

Examples

mix petal.install --install-all
mix petal.install -a --no-alpine --no-rename
mix petal.install --setup
mix petal.install avatar menu
mix petal.install --setup --no-alpine avatar menu

Features

  1. Component Installation: Install individual Petal Components or all components at once.
  2. Setup: Perform necessary setup for using Petal Components in your Phoenix project.
  3. Customization: Options to skip certain setup steps (Alpine.js, Tailwind config updates, component renaming).

Important Notes

What It Does

  1. Copy Petal CSS: Copies the Petal default CSS file to your project.
  2. Update CSS Imports: Adds the necessary import statement to your app.css file.
  3. Add Alpine.js: Adds Alpine.js script tags to your root layout file (unless --no-alpine is used).
  4. Update Tailwind Config: Modifies your Tailwind configuration to include Petal color palette (unless --no-tailwind-config is used).
  5. Copy Components: Copies selected (or all) Petal Components to your project, renaming them to fit your project's namespace (unless --no-rename is used).

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.