Menu

Alert

Renders an alert element


Heads up!

There are new tasks in your inbox.

Success

Task has been completed successfully!

Error

Something went wrong with your request.

Warning

This action will take some time to be processed.

render Alert.new do |alert|
  alert.icon(class: "mb-4") { render Phlex::Icons::Iconoir::InfoCircle.new(class: "size-4") }
  alert.title { "Heads up!" }
  alert.description { "There are new tasks in your inbox." }
end

render Alert.new(kind: :success) do |alert|
  alert.icon(class: "mb-4") { render Phlex::Icons::Iconoir::CheckCircle.new(class: "size-4") }
  alert.title { "Success" }
  alert.description { "Task has been completed successfully!" }
end

render Alert.new(kind: :critical) do |alert|
  alert.icon(class: "mb-4") { render Phlex::Icons::Iconoir::XmarkCircle.new(class: "size-4") }
  alert.title { "Error" }
  alert.description { "Something went wrong with your request." }
end

render Alert.new(kind: :warning) do |alert|
  alert.icon(class: "mb-4") { render Phlex::Icons::Iconoir::WarningTriangle.new(class: "size-4") }
  alert.title { "Warning" }
  alert.description { "This action will take some time to be processed." }
end

Usage

Add the component to your project

bundle exec essence add alert