Alert Edit

Displays a callout for user attention

Examples

Installation


rails generate shadcn-ui alert

Usage

<%= render_alert title:, description:, variant: %>

The Alert component introduces:

  • app/helpers/components/alert_helper.rb
  • app/views/components/ui/_alert.html.erb

The method render_alert defined in app/helpers/components/alert_helper.rb accepts a title: and description: required keyword arguments along with an optional variant: argument for the kind of alert to render. Skip the icon by setting the optional argument icon: to false.