The majority of components come from our open-source package "Petal Components". However, there are some only in Petal Pro. These have been put into a new private package called "Petal Framework". We are slowly adding the Petal Framework component docs to the petal.build website. Ultimately, petal.build will house all docs related to components, and these guides will more tailored to Petal Pro core functionality.
Note that for this to work you also need to add this to your <head> . This is installed by default in Petal Pro.
# in your <head>:
<.color_scheme_switch_js />
Email helpers
A set of components for email templates. Kind of like Petal Components, but for emails.
Example usage:
<h1>Let's verify your account</h1>
<p>Touch the button below to verify your account</p>
<EmailComponents.button_centered to={@url}>
Verify account
</EmailComponents.button_centered>
<EmailComponents.small_text>
If you didn't create an account with us, please ignore this.
</EmailComponents.small_text>
To see them all run this from within your directory:
defmodulePetalPro.Components.EmailComponentsdousePhoenix.Componentdefmy_new_component(assigns) do ~H""" Your component HTML goes here """endend
Then in lib/petal_pro_web/views/email_view.ex you can either alias it or import it. Since it has the same name as the PetalFramework module, you can't alias it unless you change the name away from EmailComponents.
Importing makes it more easily callable, but it can be confusing if you don't know where the function came from. We'll leave that decision up to you.
defmodulePetalProWeb.EmailViewdousePetalProWeb, :viewaliasPetalFramework.Components.EmailComponents# Import your components:importPetalPro.Components.EmailComponentsend
Now it'll be available in your email templates!
<h1>Let's verify your account</h1>
<.my_new_component />
Landing page
A set of landing page related components. For example:
This is a Petal Framework component. If you want to see how it's coded or copy it to modify it to your own needs you can run this command to see it in VSCode:
A Petal Framework component. Displays the user's avatar and will show a dropdown menu upon being clicked. Used in the navbar. Displays a list of menu items (see the Menus section).