Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Petal components section #21

Merged
merged 2 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -592,3 +592,24 @@ https://github.com/dwyl/phoenix-liveview-chat-example

We think it's _siiiiiiick_!
More examples to follow soon!

### Petal Components

<img width="545" alt="petal.build" src="https://user-images.githubusercontent.com/194400/193780264-16a4330d-df64-4f04-9c89-2d6b1146ad32.png">

Petal components are a set of reusable functions to help you build a nice UI:

![image](https://user-images.githubusercontent.com/6057298/193790320-a436dc02-d86f-49d9-9bc2-cfc7d76e4e91.png)


Follow the instructions steps at https://petal.build/components to install the
Petal components to your Phoenix project. After that you'll be able to call in your
templates the components with the syntax `<.component>...</.component>`, for example:

```heex
<.h2>Title</.h2>
```

see:
- https://petal.build/
- https://hexdocs.pm/phoenix_live_view/Phoenix.Component.html
2 changes: 2 additions & 0 deletions lib/app_web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ defmodule AppWeb do
namespace: AppWeb

# Import convenience functions from controllers
import Phoenix.Component

import Phoenix.Controller,
only: [get_flash: 1, get_flash: 2, view_module: 1, view_template: 1]

Expand Down